Comments (4)
Hi,
thanks for reporting!
It should check for invalid refs (see
openapi-schema-validator/test/test-resolve.js
Line 122 in 1353040
But apparently your case falls between the cracks.
I will check!
Kind regards,
Hans
from openapi-schema-validator.
ok, I checked and its a bit tricky :-)
Up until now validation only checked if the specification matched the JSONschema for that specification.
Your example matches the schema as the JSONschema of OpenAPI 3.0.0 allows for the $ref
at the place where you put them, and the value of the $ref
is a string as required by the JSONschema of OpenAPI 3.0.0. Hence the validator said that your schema is valid.
Since we can't validate the $ref
via the JSONschema, there needs to be an extra logic check. This check was already present in resolveRefs
but if you were doing a pure validation then resolveRefs
would not be called as resolveRefs modifies the schema, which might be undesirable.
I have a PR in the works that adds a ref check to validation so that a specification that matches the JSONschema of OpenAPI but holds invalid refs is still marked as invalid.
Kind regards,
Hans
from openapi-schema-validator.
Released as 2.1.3 on NPM.
npx -p @seriousme/openapi-schema-validator validate-api "invalid.spec.yaml"
should work correctly now.
Kind regards,
Hans
from openapi-schema-validator.
Great, thanks for such a quick fix! Everything looks cool now)
from openapi-schema-validator.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openapi-schema-validator.