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
bug: anyOf in schemas are not resolved #119
Comments
Hey thank you. anyOf certainly is important! Would you try out If the error persists, we can probably just delete that line, safe in the knowledge that the JSON Schema validation has done its job. |
Hey @philsturgeon ! I love it when collaborators follow up quickly :) I tried the beta release but it didn't seem to work: $ npm i --save-dev speccy@beta
<peer dependency warnings>
+ speccy@0.8.0-beta1
updated 1 package and audited 1365 packages in 4.804s
found 0 vulnerabilities
$ npm run lint
> MyPackage@0.0.0-development lint /Users/tarmstrong/src/MyPackage
> eslint . && speccy lint v2.0.1/openapi.yaml && speccy lint v2.1.0/openapi.yaml
Specification is valid, with 0 lint errors
Specification schema is invalid.
#/components/schemas/AnyOfExample/properties/intOrFloatProperty
expected Object {
anyOf: Array [
Object { type: 'number', format: 'float' },
Object { type: 'integer', format: 'int32' }
],
... snip ...
} to have property type
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! standard@0.0.0-development lint: `eslint . && speccy lint v2.0.1/openapi.yaml && speccy lint v2.1.0/openapi.yaml`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the standard@0.0.0-development lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/tarmstrong/.npm/_logs/2018-08-08T20_19_25_298Z-debug.log |
Whats that debug log got? This doesn't say anything much. |
|
I really don't know what all this other stuff is about. Can you interact with speccy directly instead of through whatever npm linting something or other you're doing? |
$ speccy lint v2.1.0/openapi.yaml
Specification schema is invalid.
#/components/schemas/AnyOfExample/properties/intOrFloatProperty
expected Object {
anyOf: Array [
Object { type: 'number', format: 'float' },
Object { type: 'integer', format: 'int32' }
],
... snip ...
} to have property type |
Darn. Well if its still happening in v0.8.0-beta1 then it's not anything we can do here in speccy, and it'll need to be handled in oas-kit. Mermade/oas-kit#84 |
Thank you for your attention, @philsturgeon ! |
Detailed description
When given a Schema Object where the
type
field is within ananyOf
, the linter reports an error.Consider the schema:
The linter reports:
Context
anyOf
is an important aspect of JSON Schema, which OAS has adopted. It's a valid part of the specification and should be supported in linters.Your environment
The text was updated successfully, but these errors were encountered: