swagger-codegen icon indicating copy to clipboard operation
swagger-codegen copied to clipboard

[qt5cpp][cpprest] allOf in request body schema produces blank type

Open etherealjoy opened this issue 9 years ago • 4 comments

When Using allOf in the description of a body parameter then the combination of multiple ref types is not assembled to create a new type.

Description

using allOf in the parameter schema causes no type to be generated.

Generated code void containerUpdate(QString* id, update); instead of void containerUpdate(QString* id, SWGResources update);

Swagger-codegen version

2.2.3 2.3.0 2.4.0 3.0.0

Swagger declaration file content or url
      parameters:
        - name: "id"
          in: "path"
          required: true
          description: "ID or name of the container"
          type: "string"
        - name: "update"
          in: "body"
          required: true
          schema:
            allOf:
              - $ref: "#/definitions/Resources"
              - type: "object"
                properties:
                  RestartPolicy:
                    $ref: "#/definitions/RestartPolicy"
Command line used for generation

java -jar /home/dev/swagger-codegen/modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -i /mnt/genivi-dev-platform/meta-userapp/recipes-dockerctrl/dockerctrl/sources/dockerctrl-qtapp/yaml/docker-v132-subset.yaml -o /mnt/genivi-dev-platform/meta-userapp/recipes-dockerctrl/dockerctrl/sources/dockerctrl-qtapp/gen-qt1/ -l qt5cpp --model-name-prefix SWG

Steps to reproduce

Run the command with the allOf in the parameter schema

Related issues/PRs
Suggest a fix/enhancement

etherealjoy avatar Nov 16 '17 18:11 etherealjoy

I need help to fix this. Can someone please give me some hints?

Update: After investigating I discovered that allOf (ComposedModel) in body Parameter in DefaultCodegen.java is not handled.

public CodegenParameter fromParameter(Parameter param, Set<String> imports) {

Affects other Langs as well. I dont know how to fix. :(

etherealjoy avatar Dec 18 '17 17:12 etherealjoy

@fvarose Do you have an idea what to do here, if you don't mind me bothering you?

Many thanks.

etherealjoy avatar Jan 18 '18 10:01 etherealjoy

Sorry, I have no idea what causes this, I can maybe have a look when I find the time.

fvarose avatar Jan 18 '18 10:01 fvarose

Ok, this seems to be a problem with the swagger-codegen core when I check the referenced issue. But thanks all the same.

etherealjoy avatar Jan 18 '18 10:01 etherealjoy