Closed tschaffter closed 3 years ago
There are several solutions:
requestBody
of paths is required. The OpenAPI Generator will likely use this information when generating the clients and inform the user that a request body object must be specified, even if it's an empty object.My preference goes to Option 1. This solution increases the consistency of the API as both the user and the developer know that a request body object must always be specified. The developer can then validate this object against a model. The alternative is more complicated: first the developer has to look at the schema to check if the request body is required or not, and based on the answer implement an if
condition in the controller of the API service.
Note that Option 1 is the solution adopted by Google Healthcare API. Moreover, we had a similar discussion a couple of months ago with @vpchung and @thomasyu888 about the returned object of DELETE operations. We decided to always return an empty object rather than nothing. The logic was the same and the alternative would have been that both the user and the developer would have to look closer at the schema to know if a given endpoint should return an object or not. Always returning an object makes our API more consistent.
Tagging @rrchai
Done
Fix issue raised here.