Skip to content

[qt5cpp] additionalproperties and arrays of object containing a type array is blank  #6884

@etherealjoy

Description

@etherealjoy

additionalProperties containing arrays of objects is blank
Additionally, Nested Arrays are not properly parsed

Description

The code is blank for the properties which are defined as below

  • 'Ports' is of type map 'PortMap'
  • 'PortMap' is an array of 'PortBinding'
  • 'PortBinding' is an object with two strings
Swagger-codegen version
  • 2.2.3
  • 2.3.0
  • 3.0.0
Swagger declaration file content or url
  PortMap:
    description: |
      PortMap describes the mapping of container ports to host ports, using the
      container's port-number and protocol as key in the format `<port>/<protocol>`,
      for example, `80/udp`.

      If a container's port is mapped for both `tcp` and `udp`, two separate
      entries are added to the mapping table.
    type: "object"
    additionalProperties:
      type: "array"
      items:
        $ref: "#/definitions/PortBinding"
    example:
      "443/tcp":
        - HostIp: "127.0.0.1"
          HostPort: "4443"
      "80/tcp":
        - HostIp: "0.0.0.0"
          HostPort: "80"
        - HostIp: "0.0.0.0"
          HostPort: "8080"
      "80/udp":
        - HostIp: "0.0.0.0"
          HostPort: "80"
      "53/udp":
        - HostIp: "0.0.0.0"
          HostPort: "53"
      "2377/tcp": null

  PortBinding:
    description: |
      PortBinding represents a binding between a host IP address and a host
      port.
    type: "object"
    x-nullable: true
    properties:
      HostIp:
        description: "Host IP address that the container's port is mapped to."
        type: "string"
        example: "127.0.0.1"
      HostPort:
        description: "Host port number that the container's port is mapped to."
        type: "string"
        example: "4443"

  Ports:
    $ref: "#/definitions/PortMap"
Command line used for generation

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

Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement

Fixing in the mustache template is not possible, because apparently the models are not parsed correctly.
So the 'vars' variable used while creating the members of the model does not contain the data to generate the model with the correct members.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions