openapi-generator
openapi-generator copied to clipboard
Adapter of type listed in anyOf isn't resolved
getDelegateAdapter
goes through the list of adapters, but skips mentioned adapter (in this case this
adapter). And this
and TypeToken.get({{.}}.class
refers to different model types.
https://github.com/OpenAPITools/openapi-generator/blob/69f79fb7892948590a9ffe46754c47ddd2634be1/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/anyof_model.mustache#L47
This leads to getDelegateAdapter tries to find this
adapter first and only after that it starts searching adapter for TypeToken.get({{.}}.class
by proceeding iterating through adapters list. But if TypeToken.get({{.}}.class
adapter is listed before this
adapter - custom type adapter for TypeToken.get({{.}}.class is never found... It makes clients randomly break depending on chosen names for model (as they are sorted).
Not sure is my explanation clear, TL;DR; probably getDelegateAdapter
should be replaced by getAdapter
here?