openapi-merge icon indicating copy to clipboard operation
openapi-merge copied to clipboard

When working with disputes, a discriminator's mappings are not prefixed.

Open davidjlynn opened this issue 5 months ago • 0 comments

While working with a specification which has a discriminator with a mapping inside of a oneOf, for example: yaml

components:
  schemas:
    TestSchema:
      oneOf:
        - $ref: '#/components/schemas/TestSchema1'
        - $ref: '#/components/schemas/TestSchema2'
      discriminator:
        propertyName: type
        mapping:
          t1: '#/components/schemas/TestSchema1'
          t2: '#/components/schemas/TestSchema2'

The oneOf is successfully transformed, however the mapping is left as is. For example, if I was using prefix: Disputed the result would be:

components:
  schemas:
    TestSchema:
      oneOf:
        - $ref: '#/components/schemas/DisputedTestSchema1'
        - $ref: '#/components/schemas/DisputedTestSchema2'
      discriminator:
        propertyName: type
        mapping:
          t1: '#/components/schemas/TestSchema1'
          t2: '#/components/schemas/TestSchema2'

The mapping references should also be replaced.

davidjlynn avatar Sep 09 '24 13:09 davidjlynn