Skip to content

AllOf not following $ref in enum #623

@JFCote

Description

@JFCote

This is highly related to issue #604

@gracekarina , this might interest you

I've tested with the latest available version, 1.0.33

If you have the following case, the SomeEnum will not be in the definitions of the swagger object. The difference with the fix you have done in #604 is that it's not an object, it's an enum.

swagger.yaml

swagger: '2.0'
info:
  version: '1.0.0'
  title: Swagger Petstore (Simple)
  description: A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification
  termsOfService: http://helloreverb.com/terms/
  contact:
    name: Swagger API team
    email: foo@example.com
    url: http://swagger.io
  license:
    name: MIT
    url: http://opensource.org/licenses/MIT
host: petstore.swagger.io
basePath: /api
schemes:
  - http
consumes:
  - application/json
produces:
  - application/json
paths:
  /pets:
    get:
      description: Returns all pets from the system that the user has access to
      operationId: findPets
      produces:
        - application/json
        - application/xml
        - text/xml
        - text/html
      parameters:
        - name: tags
          in: query
          description: tags to filter by
          required: false
          type: array
          items:
            type: string
          collectionFormat: csv
        - name: limit
          in: query
          description: maximum number of results to return
          required: false
          type: integer
          format: int32
      responses:
        '200':
          description: pet response
          schema:
            type: array
            items:
              $ref: './definitions.yaml#/definitions/ShippingInfo'

definitions.yaml

definitions:
  PrintInfo:
    type: object
    description: "Print info of the shipping info"
    required:
      - B
    properties:
      B:
        type: boolean
  SomeEnum:
    type: string
    enum:
      - lol1
      - lol2
      - lol3
  ShippingInfo:
    type: object
    description: "Information about the shipping for a device"
    allOf:
      - $ref: "#/definitions/PrintInfo"
      - type: object
        required:
          - A
        properties:
          A:
            $ref: "#/definitions/SomeEnum"

Metadata

Metadata

Assignees

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