APIDevTools / swagger-parser

Swagger 2.0 and OpenAPI 3.0 parser/validator
https://apitools.dev/swagger-parser
MIT License
1.09k stars 154 forks source link

Bundle() not resolving all $ref #161

Open joelfoliveira opened 3 years ago

joelfoliveira commented 3 years ago

When referencing the same component from other different components, Bundle() won't resolve the references correctly.

In this example: ApiReferences

The bundled output contains a external reference in UserValues to AssociationContext:

components:
  schemas:
    User.Context:
      type: object
      properties:
        values:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                description: Universal unique identifier of product property value.
                format: uuid
                example: dae18b3a-c5fc-4dc3-a53e-64c905d1f97b
              associationContext:
                type: array
                items:
                  $ref: >-
                    #/components/schemas/User.Context/properties/associationContext/items

API Samples: API UserContext UserValues AssociationContext

Results Obtained Expected

By changing UserValues to reference a duplicate of AssociationContext (UserValuesAssociationContext) the Bundle() works correctly. ApiReferencesWorkaround