Is it pedantic or does the order of elements matter? #206
Replies: 2 comments 3 replies
-
|
Order does not matter. |
Beta Was this translation helpful? Give feedback.
-
|
Yeah, if someone makes any assumptions about the order of the fields within a JSON object, then they are doing it wrong. JSON array is obviously a different story as it's an ordered container. Where things get a bit muddy are the XML responses since the XML syntax doesn't make a clear distinction between unordered dictionary-type structures and ordered list-type structures. But even there, it's a reasonable assumption that any repeating elements form a list where the order matters and unrepeating elements are just key-value pairs without a defined order. That being said, there would be some value in keeping the order in sync between the documentation and the OpenAPI: It would make it easier to check that the two are aligned, containing all the same properties. I wouldn't care enough to make a PR for such changes, but if someone makes such a PR, I would approve it. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
The open API spec puts items in a different order to the documents.
does this matter? because my responses all follow the documents and there is a discrepancy between the 2.
Beta Was this translation helpful? Give feedback.
All reactions