Skip to content

swagger_to_py_client.py doesn't generate any attributes specified in allOf #143

@unicman

Description

@unicman

Swagger contains following:

  Region:
    description: |
      everything you could want to know
    type: object
    allOf:
      - $ref: "#/definitions/RegionSummary"

  RegionSummary:
    type: object
    description: |
      summary information
    allOf:
      - type: object
        required:
          - id
          - realmName
          - timeCreated
        properties:
          id:
            description: Unique 
            type: string
          realmName:
            description: the name
            type: string
            minLength: 1
            maxLength: 255 # ?
          timeCreated:
            description: When the region
            type: string
            format: date-time

Expected output is Region class should either inherit from RegionSummary or contain all the attributes of RegionSummary. However, swagger_to_py_client.py generates empty class:

class Region:
    """
    Everything you could want
    """

    def to_jsonable(self) -> MutableMapping[str, Any]:
        """
        Dispatches the conversion to region_to_jsonable.

        :return: a JSON-able representation
        """
        return region_to_jsonable(self)


def new_region() -> Region:
    """Generates an instance of Region with default values."""
    return Region()

Does swagger-to support allOf? If yes, how to make it generate correct stub?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions