Skip to content

allOf with references doesn't respect import mappings #632

Description

@serejja

When upgrading to 1.11.0, it seems that allOf with external file reference doesn't work and generates broken code:

common.yml

genericResponse:
      type: object
      required:
        - message
        - requestData
      properties:
        message:
          type: string
        requestData:
          $ref: '#/components/schemas/requestData'

requestData:
      type: object
      required:
        - field1
        - field2
      properties:
        field1:
          description: field1
          type: string
        field2:
          description: field2
          type: string

api.yml

someApiResponse:
      allOf:
        - $ref: 'common.yml#/components/schemas/genericResponse'
        - type: object
          required:
            - data
          properties:
            data:
              type: object
              required:
                - field1
              properties:
                field1:
                  type: string

import mapping between common and API is set up correctly, and I see it working for other fields that don't use allOf.
What doesn't work though, is the reference to requestData in someApiResponse, because instead of being an *externalRef0.RequestData, it's being generated as just RequestData, which obviously doesn't work.

In this particular case, I have a someApiResponse, that references genericResponse, that references requestData. It seems that the code generated for genericResponse doesn't "know" the context and generates standard code without any external references

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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