Skip to content
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
merged 4 commits into from
Sep 10, 2019
Merged

Adjust spec version and add missing element #218

merged 4 commits into from
Sep 10, 2019

Conversation

taliaga
Copy link
Contributor

@taliaga taliaga commented Jun 21, 2019

No description provided.

@taliaga taliaga requested a review from c0c0n3 June 21, 2019 09:23
@@ -83,6 +83,7 @@ definitions:

ValuesArray:
type: array
items:
Copy link
Member

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:

Unlike JSON Schema, the items keyword is required in arrays. The value of items is a schema that describes the type and format of array items

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?

Copy link
Contributor

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":

# ["foo", 5, -2, "bar"]
type: array
items:
  oneOf:
    - type: string
    - type: integer

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):

components:
  schemas:
    AnyValue: {}

Copy link
Member

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 the oneOf 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:

  • works in SwaggerHub
  • works in QL w/ response validation turned off

@taliaga does it? :-)

Copy link
Member

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!

Copy link
Contributor Author

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.

@c0c0n3 c0c0n3 self-requested a review July 3, 2019 08:08
@taliaga taliaga merged commit ee909c1 into master Sep 10, 2019
@taliaga taliaga deleted the fix-spec branch September 10, 2019 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants