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

It's not clear how the request body schema is supposed to be defined for POST operations #114

Open
bbenligiray opened this issue Oct 25, 2023 · 0 comments

Comments

@bbenligiray
Copy link
Member

According to OpenAPI 3.x, request body of a POST operation is defined in the requestBody field of the operation. This isn't supported by OIS, which may cause confusion while using it.

The reasoning behind this decision was that the requestBody schema was too complex (to support any kind of a request body schema), yet the POST operations of most APIs require a non-nested JSON body. Furthermore, these operations typically do not have query parameters (in addition to the request body). As a hacky solution, we decided that in:query for POST operations are to be mapped to the request body (https://docs.api3.org/reference/ois/latest/specification.html#_4-2-1-2-in). This has three downsides:

  • We don't support query parameters for POST operations (hasn't been a problem thus far)
  • We don't support complex request body schemas (has been a problem in How to send a JSON array or object as a parameter in a POST request? airnode#1790 but we relaxed validation to allow the user to hack their way through using pre-processing, which is acceptable imo)
  • It confuses the readers of the spec. For example, @hiletmis was tripped up by this while building a frontend that makes calls for testing signed API pusher integrations.

I figured the least we can do is to leave an issue here

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

No branches or pull requests

1 participant