-
Notifications
You must be signed in to change notification settings - Fork 423
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
[WIP] Use Cornice Swagger to generate the OpenAPI specification #1033
Conversation
I didn't have time to do a thorough review, but from what I see, this looks OK to me. I don't have a problem with concentrating fundamental or common schemas in a The |
I'd love to hear @leplatrem 's thoughts on this! |
@@ -113,7 +113,7 @@ def test_validate_headers(self): | |||
for head in headers: | |||
self.request.headers = head | |||
self.assertRaises(ValidationError, unmarshal_request, | |||
self.request, self.resources['Buckets'].get_buckets) | |||
self.request, self.resources['Bucket'].get_buckets) |
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.
Ouch.. too bad we have to make dozens of changes like this. Maybe we should try to find a few minutes in a subsequent PR to extract this expression as an attribute on the test case, something like self.swagger_resource
?
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 would be good. I mean, now we are generating it automatically I don't think we should test it this way. We can probably think of something better.
Hmm, these are actually all the responses for the Resource class, and we are actually changing the record schemas (e.g allowed permissions) for each view during initialization here. Changing the error responses is not something we would probably do in the server repository, because all storage views have the exactly same error messages. We did the same with the handwritten spec. But there may be some extensions that would like to change it. I just realized we can make responses a |
CollectionRequestSchema is used only on resources, and that's why it's on |
This is needed to allow importing generic schemas on other parts of kinto core without breaking the import order. Related to Kinto#1033
Closed in favor of #1078 |
Fixes #1006
This is still early WIP but I need some feedback on the architecture. If you think the changes are "too breaking" we can rollback ASAP and find another approach. The more controversial change IMO is to move parts of the schema from resource to a separate module. I've did this to allow imports from other parts of the code that are imported before Service is defined (like errors), and most of the schemas there are not exclusive to resources. Opinions?
Todos:
Extras (can be finished at other PRs):
r? @glasserc