Skip to content

Discriminator mapping refs (anyOf) & callback refs not processed #2086

Closed
@anthochristen

Description

@anthochristen

When relative paths are used in discriminator mappings (anyOf) & callbacks the references are not processed.

Discriminator Mapping Ref sync issue:

  "requestBody": {
      "required": true,
      "content": {
          "application/json": {
              "schema": {
                  "anyOf": [
                      {
                          "$ref": "../components/schemas/adoption_request_for_bird.json"
                      },
                      {
                          "$ref": "../components/schemas/adoption_request_for_cat.json"
                      }
                  ],
                  "discriminator": {
                      "propertyName": "animal_type",
                      "mapping": {
                          "BIRD": "../components/schemas/adoption_request_for_bird.json",
                          "CAT": "../components/schemas/adoption_request_for_cat.json"
                      }
                  }
              }

In this case post the parsing the anyOf schemas becomes #/components/schemas/adoption_request_for_bird but the disciminator mapping still remains as ../components/schemas/adoption_request_for_bird.json. However the same works for OneOf.

Callback Ref issues:

{
  "{$request.body#/callback_url}/start": {
    "put": {
      "summary": "Does a callback",
      "description": "You know what it does",
      "requestBody": {
        "required": true,
        "content": {
          "application/json": {
            "schema": {
              "$ref": "../../../schemas/payload.json"
            }
          }
        }
      },
      "responses": {
        "204": {
          "description": "Your server implementation should return this HTTP status code if the data was received successfully."
        }
      }
    }
  }
}

In this case the payload schema is incorrectly searched from the openapi.json base path instead of the relative path from the callback. Also this (looking in base path instead of relative path) seems to occur for parameter examples too.

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