-
Notifications
You must be signed in to change notification settings - Fork 2
It's not clear how the request body schema is supposed to be defined for POST operations #114
Copy link
Copy link
Open
Description
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels