Replies: 1 comment 8 replies
-
@Seven24 Schema Objects behave the same no matter where they are. There have been many discussions on the best way to handle variations between request vs response, GET vs PUT vs POST, etc., both in this repository and in the one for Moonwalk (the project for designing OpenAPI 4.0). Here's the most extensive one of which I am aware. It's old but not forgotten- we've been doing some deeper re-thinking of how to organize 4.0 so details have been a bit on hold. |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to settle a debate with a colleague of mine. I contend that the required attribute should be completely ignored in any Response schema and he contends that it must be honored.
This is not an uncommon situation. One creates a schema with some required fields. References it in various Request payloads (say POST or PUT) as well as in some Response payloads (like a GET).
My argument, beyond common sense, is that the documentation is clear albeit by omission. Nowhere in the section on the Response body does it mention the required attribute but it is mentioned in the Request body section.
My colleague's argument is akin to "math is math" and that required means required even if on the Response object.
For those wondering, the issue is coming up because SalesForce's External Services functionality is throwing a fit when it encounters a Response object with a null but required field. So, the real debate is whether SalesForce's External Services functionality is incorrectly interpreting the OpenAPI spec (my contention) or whether there is an omission in the OpenAPI documentation about honoring the required attribute on fields on Response schemas.
If for some reason, this should be honored (which IMO is crazy), then a needed feature is a way to simply disable the required attribute on a given schema reference.
Beta Was this translation helpful? Give feedback.
All reactions