openapi icon indicating copy to clipboard operation
openapi copied to clipboard

Fixed the data structure for OpenApi 3

Open hbina opened this issue 4 years ago • 1 comments

  1. Enums can hold any value: boolean, strings, numbers...so just use JsonValue
  2. Items can point to Ref so wrap Schema inside ObjectOrReference
  3. Reorder ObjectOrReference because they are untagged, its better to check for Ref first

Signed-off-by: Hanif Ariffin [email protected]

hbina avatar Jan 26 '21 10:01 hbina

Reorder ObjectOrReference because they are untagged, its better to check for Ref first

Is there a reason to keep ref_path in the "Objects" with this? My understanding of openapi is that $ref excludes the possibility of any other fields, if so i think it would make sense to

  • Drop ref_path from the structs that are used as Objects
  • Fail parsing if a ref is encountered along with other properties

The current situation is odd as I implemented support for refs in a tool and then noticed that all the holes i left for ObjectOrReference::Ref were unused :-) But just swapping it may leave another hole instead, with e.g. Schema:ref_path being unused.

bergmark avatar May 13 '21 11:05 bergmark