-
Notifications
You must be signed in to change notification settings - Fork 1
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
openapi to jsonschema #1
Comments
pglass/py-openapi-schema-to-json-schema#9 shows that library does work, and could be used to do the conversion to jsonschema if you wanted to keep going down that path. Without my PR, it can still be used if this middleware gave it all of the schema objects within the openapi spec. Unfortunately there a lots of places that schema exist, so I think it makes more sense to convert the entire document once. |
i have submit a commit, hope this commit can solved the problem. :) |
It sort of did solve the problem, however many logic exceptions occur in the openapi -> jsonschema , when the openapi doesnt contain what the logic expects. Irrespective of whether the openapi spec is properly formed, Django middleware should not create new exceptions unless explicitly requested by the implementor. #3 tidies that up, and after that it is able to the endpoints in my schema which I have tested so far. |
The logic in
strict_schema
doesnt descend into the components (i.e. referenced by$ref
) and recurse as necessary to do a complete conversion of openapi to jsonschema.As a result I am seeing
I tried to quickly hack a fix using https://github.com/pglass/py-openapi-schema-to-json-schema , but it also doesnt handle complex openapi schema.
Mine is generated by https://github.com/tfranzel/drf-spectacular
instrumenta/openapi2jsonschema#24 says that tool doesnt do it either, but a comment there says that https://github.com/p1c2u/openapi-core works correctly.
It also has some Django helpers https://github.com/p1c2u/openapi-core/blob/master/README.rst#django
The text was updated successfully, but these errors were encountered: