Skip to content

OAS2->3 converter doesn't update $refs inside allOf #1261

@hkosova

Description

@hkosova

https://converter.swagger.io converts this OAS2 definition:

swagger: '2.0'
info:
  title: Conversion test
  version: '1.0.0'
paths: {}

definitions:
  Foo:
    type: object
    properties:
      foo:
        type: string
  Bar:
    type: object
    properties:
      bar1:
        $ref: '#/definitions/Foo'     # This $ref is converted properly to `#/components/schemas`
      bar2:
        allOf:
          - $ref: '#/definitions/Foo' # This $ref remains as `#/definitions`

to this OAS3 definition:

...
components:
  schemas:
    Foo:
      type: object
      properties:
        foo:
          type: string
    Bar:
      type: object
      properties:
        bar1:
          $ref: '#/components/schemas/Foo'
        bar2:
          type: object
          allOf:
          - $ref: '#/definitions/Foo'   # should be '#/components/schemas/Foo'

Note that the $ref inside allOf is not updated.

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