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

Improve how LookupArgumentSets are defined #4

Closed
paulsturgess opened this issue Nov 15, 2023 · 3 comments · Fixed by #21
Closed

Improve how LookupArgumentSets are defined #4

paulsturgess opened this issue Nov 15, 2023 · 3 comments · Fixed by #21
Assignees

Comments

@paulsturgess
Copy link
Contributor

paulsturgess commented Nov 15, 2023

We should take a look and see if we can improve how LookupArgumentSets are declared in the spec – currently swagger-editor allows both params (e.g. id and permalink) to be sent in the request which triggers an error in Apia.

We should take a look at using a discriminator object such as oneOf which I think should allow us to specify that either the id is sent or the permalink is sent. But not both.

@paulsturgess
Copy link
Contributor Author

Jim also left a comment about this here: https://github.com/krystal/katapult/issues/2050#issuecomment-1801829013

@paulsturgess
Copy link
Contributor Author

Whilst looking at this we should implement if the query param is required or not.

@paulsturgess paulsturgess self-assigned this Nov 17, 2023
@paulsturgess paulsturgess changed the title Improve how ArgumentSets are defined Improve how LookupArgumentSets are defined Nov 17, 2023
@paulsturgess
Copy link
Contributor Author

OK I dug into this some more and the openapi 3.0 spec actually admits that it cannot describe inter-dependant params.

https://swagger.io/docs/specification/describing-parameters/#dependencies

OpenAPI 3.0 does not support parameter dependencies and mutually exclusive parameters.

There's an issue about it here: OAI/OpenAPI-Specification#256

They suggest returning a 400 with an error explaining it. Which is what Apia already does...

More than one value has been provided for a lookup argument set. Only one option may be provided.

We could update the description of the params, to at least explain that only one param is expected.

paulsturgess added a commit that referenced this issue Nov 17, 2023
OpenAPI 3.0 does not support parameter dependencies and mutually exclusive parameters.

https://swagger.io/docs/specification/describing-parameters/#dependencies

This is a complex topic with a lot of debate:
OAI/OpenAPI-Specification#256

We know that our LookupArgumentSets are mutually exclusive, so the best thing is to
add a description explaining this, so that it will appear in documentation and tools like the swagger editor.

Apia already returns a 400 with a friendly error message.

closes: #4
paulsturgess added a commit that referenced this issue Nov 17, 2023
OpenAPI 3.0 does not support parameter dependencies and mutually exclusive parameters.

https://swagger.io/docs/specification/describing-parameters/#dependencies

This is a complex topic with a lot of debate:
OAI/OpenAPI-Specification#256

We know that our LookupArgumentSets are mutually exclusive, so the best thing is to
add a description explaining this, so that it will appear in documentation and tools like the swagger editor.

Apia already returns a 400 with a friendly error message.

closes: #4
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 a pull request may close this issue.

1 participant