Open tamis-laan opened 2 years ago
If swagger-jsdoc
is compliant, then it should work if you JSON.stringify(schema)
before passing it in.
Didn't work:
error: openapi.validator: spec could not be read at {"openapi":"3.0.0","info":{"title":"Project ","description":"API","version":"1.0.0"},"servers........
Seams like it is interpreting the string as a file path rather then then a schema.
As far as I can see my first example should work, you can pass an object as the apiSpec: https://github.com/cdimascio/express-openapi-validator#%EF%B8%8F-apispec-required
error: openapi.validator: args.apiDoc was invalid. See the output.
What does the output say?
Looks like it works now, turns out I had an error in my schema.
This indicates that the schema is invalid:
error: openapi.validator: args.apiDoc was invalid. See the output.
What I don't understand is, if validation is done on the schema, why it does not tell me what is wrong with the schema.
This would be great for debugging.
Is it possible to combine swagger-jsdoc with express-openapi-validator?
The following code:
Gives the error: