kin-openapi icon indicating copy to clipboard operation
kin-openapi copied to clipboard

discuss: refs in discriminator object

Open jgresty opened this issue 1 year ago • 1 comments

I have noticed that while the upstream openapi 3 spec for discriminator object specifies the data type is Map[string]string, in their written examples they use refs: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#discriminator-object

While this library sticks to the literal spec type definition, we have noticed many real world specs which do accept refs in this field. Since even the upstream spec is not well defined here perhaps this library should be more lax?

Curious to hear opinions about this. I have also raised an issue upstream about this: https://github.com/OAI/OpenAPI-Specification/issues/4138

jgresty avatar Oct 16 '24 08:10 jgresty

So from upstream the typing is correct as reference objects also use type string for their referenced strings.

In this case I think the discriminator mapping object needs to be considered in functions such as InternalizeRefs and Validate

jgresty avatar Oct 16 '24 17:10 jgresty