Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Unrecognized token 'object': expecting true, false or null" describing json response #82

Open
marcosox opened this issue Jun 20, 2017 · 4 comments

Comments

@marcosox
Copy link

Hello, I am using raml-tester 0.9.1 to unit-test my API backend. This is the raml document:

#%RAML 1.0
title: example REST API
baseUri: http://localhost:8080/exampleBackend
version: 1.0
mediaType: application/json
/status:
  description: Reports the backend status and configuration
  get:
    responses:
      200:
        body:
          application/json:
            type: object
            properties:
              version:
                type: string
                description: application version
              frontendConfigFilename:
                type: string
                description: frontend configuration file
              baseApiUrl:
                description: base url
                type: string
              listeningIPaddress:
                description: IP address
                type: string
              listeningPort:
                description: TCP port
                type: number
              deployedVerticlesNumber:
                description: deployed verticles
                type: number
              workerPoolSize:
                description: worker pool size
                type: number
              clustered:
                description: clustered option value
                type: boolean
                required: false

However, when I run the test:

checking.path(config.getBaseApiUrl()+"/status").request().get();
Assert.assertThat(checking.getLastReport(), RamlMatchers.hasNoViolations());

It fails with this output:

java.lang.AssertionError: 
Expected: To be empty
     but: 
Response violations:
  - Body does not match schema for action(GET /status) response(200) mime-type('application/json')
    Content: {
      "Frontend_config_filename" : "frontend.properties",
      "Version" : "UNKNOWN",
      "Base_API_url" : "/exampleBackend",
      "Listening_IP_address" : "0.0.0.0",
      "Listening_port" : 8080,
      "Deployed_verticles_number" : 1,
      "Worker pool size" : 1,
      "Clustered" : false
    }
    Messages:
    - Schema invalid: Unrecognized token 'object': was expecting ('true', 'false' or 'null')
     at [Source: Inline schema definition; line: 1, column: 13]

Ignoring the fact that the error messages are "poorly documented" to say the least, I don't understand what is wrong in my schema, and I suspect it has something to do with the parser instead. Any idea?

@ChristopheELIE
Copy link

Hi @marcosox,

I'm currently stuck with the same issue. Did you end up finding a solution to this problem ?

@marcosox
Copy link
Author

marcosox commented Mar 5, 2019

@ChristopheELIE
nope, as you can see this project is unmaintained. I migrated to other solutions, sorry.

@ChristopheELIE
Copy link

Thank you for the quick response.

That's do damn sad.
What did you use to work around this then ?
I need to compare a JSON response from my API to the RAML definition (i.e. the type field in the body field) and despite this (unmaintained) project I can't seem to find one that would do what I need.

@marcosox
Copy link
Author

I switched to other projects so I cannot help you with that, sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants