-
Notifications
You must be signed in to change notification settings - Fork 47
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
Add a single-file example #9
Conversation
f219bf1
to
276caac
Compare
@@ -59,6 +59,7 @@ def wrapper_view(context, request): | |||
) | |||
else: | |||
# Do the view | |||
request.openapi_validated.raise_for_errors() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the _pyramid_openapi3_validation_view_name
view is not configured, we shouldn't just silently swallow validation errors and continue, but raise the appropriate validation exception.
@@ -151,7 +152,6 @@ def spec_view(request): | |||
|
|||
config.add_route(route_name, route) | |||
config.add_view(route_name=route_name, view=spec_view) | |||
config.add_view(route_name=route_name, view=spec_view) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably leftover of a rebase gone wrong.
276caac
to
c09b4bb
Compare
if __name__ == "__main__": | ||
"""If app.py is called directly, start up the app.""" | ||
with tempfile.NamedTemporaryFile() as document: | ||
document.write(OPENAPI_DOCUMENT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Swagger client examples require the path to JSON spec https://github.com/swagger-api/swagger-js#import-in-browser. I think is better to expose JSON and yaml as routes, so that it can actually be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking if you use API outside of the API explorer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, to convert YAML into JSON and publish both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, so add another handler for JSON request like for yaml
https://github.com/niteoweb/pyramid_openapi3/blob/master/pyramid_openapi3/__init__.py#L133
And then the example in https://github.com/swagger-api/swagger-js#in-browser should be valid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's completely out of the scope of this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great to me, I love it!
No description provided.