OpenAPITools / OpenAPITools/openapi-generator
[BUG] [python-flask] member variable incorrect
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
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?
- [Optional] Bounty to sponsor the fix (example)
Description
member variable incorrect
openapi-generator version
v4.3.0
OpenAPI declaration file content or url
openapi: 3.0.0
info:
version: "1.0.0"
title: "Test"
paths:
/in:
get:
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/C'
components:
schemas:
A:
type: object
properties:
a:
type: string
B:
type: object
properties:
b:
type: string
allOf:
- $ref: '#/components/schemas/A'
C:
type: object
properties:
c:
type: string
allOf:
- $ref: '#/components/schemas/B'
Command line used for generation
docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli:v4.3.0 generate -i /local/x.yaml -g python-flask -o /local/out/python -Dmodels
Steps to reproduce
- save spec file as x.yaml in current directory
- run command above
- cat out/python/openapi_server/models/c.py only member variable a/c in class C
- paste spec file into http://editor.swagger.io/ all member variable a/b/c in class C
Related issues/PRs
Maybe the same issue? https://github.com/OpenAPITools/openapi-generator/issues/927
Suggest a fix
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the provided OpenAPI YAML and the python-flask generator command, then inspect the generated out/python/openapi_server/models/c.py. Compare class C with the inherited properties shown in Swagger Editor, especially a, b, and c. Done means the generated C model includes all inherited member variables and the relevant regression behavior is covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- flask, java, openapi, python
- Domain
- api, backend-api-design
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100