cybertk / cybertk/ramlev

Clean up validation outputs

Open
#19 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
CoffeeScript
Stars
30
Forks
5
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running the RAML validation that produces the raw Mocha output shown in the issue, then trace where that output is assembled. Compare the current output with each checklist item: remove the stack, identify the invalid example's RAML line, and improve JSON-schema error formatting. Done means validation failures are shorter and provide the requested context.

Written by the indexing model from the issue text.

Assessment

Tech stack
coffeescript
Domain
testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.