New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple body-types in an endpoint with same model (referenced via $ref
) results in ambiguity in generated code
#1004
Comments
I worked around this by using a custom template for
With this custom template in a location like I suspect this is not a proper fix, which probably needs a better way of handling differing body types with the same class names. I'm not really knowledgable enough about this codebase to do that, just sharing in case it helps someone else. |
Actual Behavior
When an endpoint has multiple body types, each referencing the same model (via a
$ref
key), the generator generates the same class name for each body types, which results then in the following generated code:As you can see, both if-statement's conditions will resolve to
True
, therefore only the last body type will be used.Desired Behavior
The body-type should be part of the generated class name to avoid such ambiguities.
Or an
if/elseif/else
should be used in the template (which would result in the first one being applied ONLY).OpenAPI Spec File
The OpenAPI spec is from Netbox, but here is the relevant snippet:
The text was updated successfully, but these errors were encountered: