Skip to content

[Bug]: Fix Generating Object class attribute when having embedded allOf schema #12635

@Chhida

Description

@Chhida

Description

We want to have the same behavior as open-api-generator,
Fix Generating Object class attribute when having embedded allOf schema

Swagger Codegen Version

         <plugin>
                   <groupId>io.swagger.codegen.v3</groupId>
                   <artifactId>swagger-codegen-maven-plugin</artifactId>
                   <version>3.0.73</version>
                   <executions>
                       <execution>
                           <id>generationSwaggerInfoModule</id>
                           <phase>generate-sources</phase>
                           <goals>
                               <goal>generate</goal>
                           </goals>
                           <configuration>
                               <modelPackage>--------</modelPackage>
                               <invokerPackage>---------</invokerPackage>
                               <apiPackage>---------</apiPackage>
                               <inputSpec>-----------------</inputSpec>
                               <generateModelDocumentation>false</generateModelDocumentation>
                               <language>java</language>
                               <library>jersey3</library>
                               <generateApiTests>-----------</generateApiTests>
                               <configOptions>
                                   <dateLibrary>java8-localdatetime</dateLibrary>
                               </configOptions>
                           </configuration>
                       </execution>
                   </executions>
               </plugin>

Language / Generator

java

OpenAPI/Swagger Spec

... "responses": { "200": { "description": "descriptionnn", "content": { "application/json": { "schema": { "allOf": [ { "$ref": "#/components/schemas/Classe1" }, { "type": "object", "properties": { "resultat": { "allOf": [ { "$ref": "#/components/schemas/Classe2" }, { "type": "object", "properties": { "content": { "type": "array", "items": { "$ref": "#/components/schemas/Classe3" } } } } ] } } } ] } } } }, ....

Image

Steps to Reproduce

java -jar swagger-codegen/modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -i api/file.json -l java

Expected Behavior

same behavior with openApi generator, we want to generate well structered usable Objects like described in the json input

Actual Behavior

Image

Related Issues / Repos

The fix should be done in these repo:
https://github.com/swagger-api/swagger-codegen-generators
and
https://github.com/swagger-api/swagger-codegen
#12637

Environment

  • OS: Ubuntu 22.04
  • Java Version: OpenJDK 17
  • Build Tool: CLI, Maven

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions