-
Notifications
You must be signed in to change notification settings - Fork 13
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
Update spec to OpenAPI 3.0.1 #101
Conversation
1 similar comment
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 think it would better if we kept compatibility with swagger v2 at least for now, it will make the transition much easier. Other minor comments in-lined.
The validator was not only responsible for validating the parameters, it's also responcible for casting the incoming parameters to right types. I believe the logic there with _paramCoersionFun and _bodyCoersionFun was dependent on swagger 2, so it now doesn't work. This is why, for example, you needed to JSON.parse some stuff manually here https://github.com/wikimedia/restbase/pull/1120/files#diff-d91965930eda1e26c9b5db0d3041c4acR590 |
The tests for the validator should also be updated even more, some of the specs in the tests use outdated stuff, for example 'formData' |
Let's, for now, remove |
@@ -43,44 +42,44 @@ const supportedValidators = ['maximum', | |||
* @constructor | |||
*/ | |||
class Validator { | |||
constructor(parameters, definitions) { | |||
constructor(parameters = [], requestBody = {}, schemas) { |
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.
The name 'requestBody' is a little confusing. It's the req body spec, not the body itself right? Can we make it less confusing?
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, here we assume that only 'schemas' out of components will be used in parameter definitions (like we do now in RESTBase) for example. Starting to use parameters
components seem nice, we have a lot of shared parameters like title
or accept
between endpoitns, so abstracting that out would be neat. However, these 2 PRs are already enormous, so we can followup to do that in the next iteration. For now, would you mind adding a comment that that is not supported?
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.
IDK requestBody
is what is used in the swagger docs and spec so it seems appropriate to follow that name.
I did make a note that parameters and requestBodies are not currently supported in components.
Almost there! Left a couple of comments, but overall LGTM |
- `swagger: 2.0` has been replaced with `openapi: 3.0.1` - `definitions` was renamed to `schemas` and `securityDefinitions` to `securitySchemes` and they all were moved inside components - servers replaces the basePath keywords used in OpenAPI 2.0 Bug: T218218
Published as v0.12.0 |
swagger: 2.0
has been replaced withopenapi: 3.0.1
definitions
was renamed toschemas
andsecurityDefinitions
tosecuritySchemes
and they all were moved inside componentsBug: T218218