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

Optionally support treating $ref like JSON Schema #45

Merged
merged 2 commits into from
Apr 11, 2018

Conversation

philsturgeon
Copy link
Contributor

@philsturgeon philsturgeon commented Apr 5, 2018

We use JSON Schema for contract testing, and want to reuse those JSON Schema models for OpenAPI documentation. Seeing as OpenAPI has imperfect (subset & superset) support for JSON Schema, we have to convert one to the other at runtime.

For now it is using an optional switch, which is a little annoying to do every time, but when #14 is done that'll just go in the config file.

Example

screen shot 2018-04-06 at 11 48 21 am

@coveralls
Copy link

coveralls commented Apr 5, 2018

Coverage Status

Coverage decreased (-0.6%) to 64.286% when pulling 4b0159a on feature/json-schema into 17ce81b on master.

@@ -822,11 +830,6 @@ function checkSecurity(security,openapi,options) {

function validateSync(openapi, options, callback) {
setupOptions(options,openapi);
if (options.jsonschema) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was some old JSON Schema option which wasnt documented or used, so I killed it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's documented here and used unless you removed it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I removed it :) I dont think its a feature we'll need in Speccy.

lint.js Outdated
}
return output;
}

function readableJsonSchemaMessages(err) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The huge errors were making me upset, so this change ended up in this PR.

@philsturgeon
Copy link
Contributor Author

I've trimmed this PR down a little for easier reviewing. The errors stuff has been moved out to #47.

Copy link
Contributor

@dangoosby dangoosby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good and tests pass 👍

@philsturgeon philsturgeon merged commit a7c9f27 into master Apr 11, 2018
@philsturgeon philsturgeon deleted the feature/json-schema branch April 11, 2018 20:47
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

Successfully merging this pull request may close these issues.

None yet

4 participants