[BUG] Using `allOf` and `$ref` generates an `object` in the python model when it should be a `string`
See original GitHub issueBug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What’s the actual output vs expected output?
Description
openapi-generator version
Docker CLI latest
OpenAPI declaration file content or url
BankTransferCreateRequest:
title: BankTransferCreateRequest
type: object
description: BankTransferCreateRequest defines the request schema for `/bank_transfer/create`
properties:
access_token:
description: Some Description
allOf:
- $ref: '#/components/schemas/AccessToken'
AccessToken:
title: AccessToken
type: string
description: The access token associated with the Item data is being requested for.
/bank_transfer/create:
post:
operationId: bankTransferCreate
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/BankTransferCreateRequest'
Generation Details
$(OPENAPI_GENERATOR_LATEST) -g python -i local/$(OPENAPI_FILE) -o local/$(OUTPUT_FOLDER)/generated-python
Steps to reproduce
Run the generator, try accessing the BankTransferCreateRequest
model. See that access_token
is object
instead of string
.
return {
'access_token': (object,), # noqa: E501
}
Related issues/PRs
Suggest a fix
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:21 (19 by maintainers)
Top Results From Across the Web
[BUG] Python client code generation with allOf and discriminator
I am trying to generate python client code from yaml that uses allOf with a discriminator property, generated code in 4.3.1 is not...
Read more >swagger codegen missing attributes with allOf - Stack Overflow
When generating a python client we notice that model classes generated seem to be missing any attributes defined in the first allOf reference....
Read more >Using $ref - Swagger
According to RFC3986, the $ref string value (JSON Reference) should contain a URI, which identifies the location of the JSON value you are...
Read more >Language Guide (proto3) | Protocol Buffers - Google Developers
This is a reference guide – for a step by step example that uses many of ... Python is a little different —...
Read more >Understanding JSON Schema 2020-12 documentation
Schema Composition¶ ; allOf ·, the given data must be valid against all of the given subschemas. · "allOf" · "string" }, ;...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Re-opening this until examples have been added in python-experimental verifying that this is working at levels deeper than a root component with composition. Tests are needed of:
If you define patient as its own component and then $ref to patient in PatientScanDto does this work? I suspect that this is an openapi inline schema issue and is not specific to the python generator. Does you allOf define the value in patient? If so should allOf be indented?