-
Notifications
You must be signed in to change notification settings - Fork 49
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
Adjust spec version and add missing element #218
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 is hairy. The Swagger 2 spec basically says it should be the same as
items
in the JSON schema:but the JSON schema they refer to is v4:
which seems to say nothing about the meaning of
items
without a type. The Swagger 3 spec says:which seems to imply you have to specify a type, but then again it isn't saying it explicitly.
What should we do then? Does this work in SwaggerHub? And does it work in Quantum Leap with response validation turned on?
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.
hi @c0c0n3, i think for openapi solution is very easy:
https://swagger.io/docs/specification/data-models/data-types/
check "Mixed-Type Arrays":
i suspect we could have also array, object or whatever there.
another alternative if this is not enough, is refer to a schema that is "Any Type" (check the section in the same link above):
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'd use
AnyValue
just to get the ball rolling when we make the switch to Swagger 3/Open API. Then I'd also like to use theoneOf
attribute, but that will have to be kept in synch with the types we accept in the notifications which might require a bit more of thinking since we'll have to review the mapping we do on inserting entities.In the meantime, since we have Swagger 2 but will soon update to 3, for my money this PR can go in as is as long as it:
@taliaga does it? :-)
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.
Cool, so it works on SwaggerHub and in QL with response validation off. Happy days!
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 agree with your comments, we need to review the actually supported array types with QL (and either prevent or support mixed types).
The purpose of this PR was to align the versioning as requested. In the same go, I wanted to leave it clean of warnings (swagger validator was complaining about an array without items). Empty items was OK but I've checked now again and according to https://swagger.io/docs/specification/data-models/data-types/ it should have a {}.
This is just to keep consistency and remove warnings. As mentioned, we'll need to review the types altogether.