-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Open
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- What's the version of OpenAPI Generator used?
- Have you search for related issues/PRs?
- What's the actual output vs expected output?script-client-produces-a-wrong-object-for-a-string-enum-type-that-is-used-with-ref))
Description
PHP model is generated with OneOfModelAModelB
as type for $openAPITypes
for
foo:
oneOf:
- $ref: 'modelA'
- $ref: 'modelB'
openapi-generator version
master at 046db19
Suggest a fix
I think that it would be possible to create a type string like oneOf[ModeA, ModelB]
in AbstractPhpCodegen.getTypeDeclaration and then deal with that in deserialiser like is done with map[K, V]
types. Ie match the type string to oneOf[
there and try to deserialize all the enclosed options until a valid deserialization is found.
If this seems like a legit approach I might be willing to do it as I need some reasonable way to handle this. Or if this has been considered before but the plan lacks implementation that would be something I could do also.
thejov, RicardoSoares8, renato-gomes, bhoehl and hanimayahi