Skip to content

External $refs and polymorphism: models for subtypes not generated #1885

@llorllale

Description

@llorllale

Problem statement

Models not generated for subtypes of a type when both defined in external $ref.

Swagger specification

In this example, WriteRequest will not be generated.

swagger.yaml:

...
paths:
  /collections:
    post:
      ...
      parameters:
        - name: serverRequest
          shema:
            $ref: 'collections.yaml/#BaseRequest' 

collections.yaml

BaseRequest:
  type: object
  discriminator: '@type'
  properties:
    '@type':
       type: string
    ...
WriteRequest:
  type: object
  allOf:
    - $ref: '#BaseRequest'
    - properties:
          ...

Steps to reproduce

Take something similar to the examples above and just do swagger generate server --spec=swagger.yaml. The model for BaseRequest will be present, but not for WriteRequest.

Environment

swagger version: 0.18.0
go version: 1.11.4
OS: Ubuntu 18.04

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions