GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||
GeezerVison is showing github.com — Multiple body-types in an endpoint with same model (referenced via `$ref`) results in ambiguity in generated code · Issue #1004 · openapi-generators/openapi-python-client Open Description
Actual BehaviorWhen an endpoint has multiple body types, each referencing the same model (via a def _get_kwargs( # ... ): # ... if isinstance(body, WritableJournalEntryRequest): _json_body = body.to_dict() _kwargs["json"] = _json_body headers["Content-Type"] = "application/json" if isinstance(body, WritableJournalEntryRequest): _files_body = body.to_multipart() _kwargs["files"] = _files_body headers["Content-Type"] = "multipart/form-data" # ... As you can see, both if-statement's conditions will resolve to Desired BehaviorThe body-type should be part of the generated class name to avoid such ambiguities. OpenAPI Spec FileThe OpenAPI spec is from Netbox, but here is the relevant snippet: "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WritableJournalEntryRequest" } }, "multipart/form-data": { "schema": { "$ref": "#/components/schemas/WritableJournalEntryRequest" } } }, "required": true }, Reacted by Vincent Simonin, Tim Schupp, sfowl and Viktor Sokolov Reacted by sfowl Activity
MetadataMetadataAssigneesLabelsNo labels TypeProjectsMilestoneRelationshipsDevelopmentIssue actions | ||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |