-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Description
I would like the specification to allow a requestBody in the DELETE method and other methods without explicitly defined semantics.
One of the answers in this StackOverflow post states: "The spec does not explicitly forbid or discourage it, so I would tend to say it is allowed."
I would agree with that statement.
Currently the OpenAPI spec says "The requestBody is only supported in HTTP methods where the HTTP 1.1 specification RFC7231 has explicitly defined semantics for request bodies."
I think this should raise a notice, but not be unsupported and raise an error.
Addendum:
As I mentioned in a comment below, if you do choose to create a batch delete method on your API, whether or not anyone recommends it, make sure to check your cache settings and think about how these settings will interact with DELETE requests. Calling DELETE
on /users
with data [3,4]
will not invalidate the cache for /users/3
or /users/4
, so a GET request to either of them may return invalid data depending on cache settings. My comment below describes methods of mitigating this.