Return the data type "string" for the enum PHP class in the JSON Schema document.#4857
Return the data type "string" for the enum PHP class in the JSON Schema document.#4857ymaillard wants to merge 1 commit into
Conversation
…ma document. Actually, the JSON Schema document specifies the data type "object". According to my interpretation of the specification, it should be a string ( https://swagger.io/docs/specification/data-models/enums/ )
|
I don't think the |
I read on this page https://swagger.io/docs/specification/data-models/data-types/, 'format' is an open value. By example, I assume 'uuid' format used in the same method is not a value defined by open api specification. So |
|
|
|
Ok I understand. Thanks for json-schema reference. I change my PR by removing the 'format' attribute. Is it ok for you ? |
|
Yes, also you should add a unit test. |
|
A Backed Enum may be backed by types of int or string, and a given enumeration supports only a single type at a time. |
|
https://3v4l.org/dLRMX#v8.1.8 is an approach to find the backed type and associate it accordingly, or fall back into embedded object or resource as proposed in #2254 |
|
This can be added as well for GraphQl with OLYBe@1b63666 |
|
Superseded #5120. |
Actually, the JSON Schema document specifies the data type "object" for an enum property. According to my interpretation of the specification, it should be a string ( https://swagger.io/docs/specification/data-models/enums/ )
This PR add a test if the class is a BackedEnum class and in this case, return an array ['type'=>'string, 'format'=>'enum']