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

Clean up validation outputs #19

Open
3 tasks
cybertk opened this issue Mar 5, 2015 · 2 comments
Open
3 tasks

Clean up validation outputs #19

cybertk opened this issue Mar 5, 2015 · 2 comments

Comments

@cybertk
Copy link
Owner

cybertk commented Mar 5, 2015

Currently, the outputs of validation is raw mocha results, it's a bit verbose.

Like,

  21) /repos/{ownerId}/{repoId}/milestones POST response 201:
     AssertionError: Got unexpected response body:
{
    "url": "https://api.github.com/repos/octocat/Hello-World/milestones/1",
    "number": 1,
    "state": "open",
    "title": "v1.0",
    "description": "",
    "creator": {
        "login": "octocat",
        "id": 1,
        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
        "gravatar_id": "somehexcode",
        "url": "https://api.github.com/users/octocat"
    },
    "open_issues": 4,
    "closed_issues": 8,
    "created_at": "2011-04-10T20:09:31Z",
    "due_on": null
}
Error: expected value to match json-schema '{"$schema":"http://json-schema...' -> '{"url":"https://api.github.com...'
      invalid type: null (expected string)
          schema: {"$schema":"http://json-schema.org/draft-03/schema","type":"...
          rule:   /properties/due_on/type -> "string"
          field:  /due_on -> null: null
      at Function.assert.jsonSchema (/usr/local/lib/node_modules/ramlev/node_modules/chai-json-schema/index.js:176:40)
      at Test.assertExample (/usr/local/lib/node_modules/ramlev/lib/test.js:77:21)
      at Test.assertExample (/usr/local/lib/node_modules/ramlev/lib/test.js:3:61)
      at Test.run (/usr/local/lib/node_modules/ramlev/lib/test.js:56:21)
      at Object.suite.addTest.Mocha.Test._.bind.test (/usr/local/lib/node_modules/ramlev/lib/test-runner.js:37:19)
      at Test.Runnable.run (/usr/local/lib/node_modules/ramlev/node_modules/mocha/lib/runnable.js:217:15)
      at Runner.runTest (/usr/local/lib/node_modules/ramlev/node_modules/mocha/lib/runner.js:373:10)
      at /usr/local/lib/node_modules/ramlev/node_modules/mocha/lib/runner.js:451:12
      at next (/usr/local/lib/node_modules/ramlev/node_modules/mocha/lib/runner.js:298:14)
      at /usr/local/lib/node_modules/ramlev/node_modules/mocha/lib/runner.js:308:7

Places can improve:

  • Remove error stack
  • Locate the line # of invalid example in RAML
  • Better error output for json
@bpytlik
Copy link

bpytlik commented Aug 30, 2016

I'd suggest at least allowing for an option to be set that displays the entire schema instead of only the first tiny bit. That may help debug issues where the schema has been written incorrectly.

@cybertk
Copy link
Owner Author

cybertk commented Aug 30, 2016

Agree

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