Map vs list in responses (and in general) #25
Replies: 3 comments 2 replies
-
One of the design goals is
so I'd prefer lists over maps.
Compiling into Moonwalk is easier if the compiler doesn't have to invent map keys. |
Beta Was this translation helpful? Give feedback.
-
Oops. Didn't see this one before submitting a recent proposal. @arno-di-loreto Should we merge these or do you want to keep this separate? My proposal suggests changing a lot more than just |
Beta Was this translation helpful? Give feedback.
-
I've consolidated this at #32 (comment) by copying this original post and the (non-logistical) reply into a comment thread, so let's close this discussion |
Beta Was this translation helpful? Give feedback.
-
Thinking aloud about
responses
being a map vs a list.Unless I missed something, the reusable part of a response is what is inside the key.
That means :
If
responses
is a list:In that case (list), I wonder if sets of responses couldn't be defined. When a $ref is used, it could be a reference to a single response or a set of responses (defined in components.responsesSets) (but that's another story).
This question is also a general concern: Are some guidelines defined to help choose one or another in OpenAPI v4 design?
For instance, having headers as a map in v3 led to some issues (losing header names in components.headers). The same goes for examples being a map, the extra key level was finally redundant with the info of the example.
Responses as a map:
Responses as a list
Beta Was this translation helpful? Give feedback.
All reactions