-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
DefaultCodegen: Inheritance (allOf) parent not working when it is not at first position #340
Comments
Tested it with v3 as well as v2 |
It works just fine with Swagger Codegen 2.3.1 |
Might be a duplicate of #192 |
Can you check the latest |
I can not find any 3.0.3-SNAPSHOT, but I just pulled and build current Master. There is still no inherited Attributes in some classes. (In others the 'extend' ist used just fine). I think the reason is: If you use 'allOf' and then a $ref as the first array element it works just fine. But if the $ref is a later array Element (e.g. the last one) the 'extend' isn't generated. This wasn't an Issue with Swagger-Gen so far. |
Our SNAPSHOT builds are pushed to the sonatype snapshot repository: For example the CLI jar is the newest jar in this folder: Or you can just use Maven to download it for you. Anyway thanks for having tested this... You are telling that this works: definitions:
SomeObject:
type: object
allOf:
- $ref: "#/definitions/OtherObject"
- type: object
required:
- bla
properties:
bla:
type: string
OtherObject:
type: object
properties:
p1:
type: string
p2:
type: string And this one does not work: definitions:
SomeObject:
type: object
allOf:
- type: object
required:
- bla
properties:
bla:
type: string
- $ref: "#/definitions/OtherObject"
OtherObject:
type: object
properties:
p1:
type: string
p2:
type: string If this is your issue, I can have a look at it. |
Ah thanks for the links, I will check it out. Yes, your example is correct, didn't notice that pattern when I created the issue, but now that I know it, it seems to be correct for all problems |
Well with |
The way Lines 3949 to 3959 in d3b1721
In a In my opinion we could improve this by taking the first @OpenAPITools/generator-core-team what do you think? |
I'm getting a bunch of these errors as well when trying to generate typescript code.
|
I agree with that. I'll file a PR to improve so. 😉 |
Description
The inheritance is not working, the inherited attributes are not included in the generated files. (E.g. GetProofingConfigDto misses all ProofingConfigDto attriubtes)
Additionally, the generator warns about Objects, which SwaggerCodegen did not:
[main] WARN o.o.codegen.DefaultCodegen - Unknown type found in the schema: object
openapi-generator version
3.0.2
OpenAPI declaration file content or url
https://github.com/janssen92/swagger-feedback-service-api/blob/testOpenApiGenerator/swagger-feedback.json
https://github.com/janssen92/swagger-feedback-service-api/blob/testOpenApiGenerator/swagger-feedback-conf.json
Command line used for generation
java -jar ~/git/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -i swagger-feedback.json -g spring -o ~/testOpenApiGen --library spring-boot --config swagger-feedback-conf.json
But also same result with less parameters:
java -jar ~/git/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -i swagger-feedback.json -g spring -o ~/testOpenApiGen
Steps to reproduce
The text was updated successfully, but these errors were encountered: