swagger-editor icon indicating copy to clipboard operation
swagger-editor copied to clipboard

Discriminator Mapping Ref not validated

Open govindrai opened this issue 3 years ago • 0 comments

Q&A

  • OS: macOS]
  • Browser: chrome
  • Version: 95
  • Method of installation: Online at editor.swagger.io
  • Swagger-Editor version: I couldn't find the version online that you're using I assume it's the latest as of Nov 16th, 2021
  • Swagger/OpenAPI version: OpenAPI 3.0

Content & configuration

Example Swagger/OpenAPI definition:

openapi: "3.0.1"
info:
  title: random api
  version: "1"
paths:
  /user:
    get:
      responses:
        '201':
          description: successful operation
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: "#/components/schemas/User"
                  - $ref: "#/components/schemas/Employee" #<--- this lines throws error
                discriminator:
                  propertyName: objectType
                  mappings:
                    user: "#/components/schemas/User"
                    employee: "#/components/schemas/Employee" #<--- this line should also throw error but doesn't
components:
  schemas:
    User:
      type: "object"
      properties:
        name:
          type: "string"

Describe the bug you're encountering

The above, when linted in swagger editor correctly reports: $refs must reference a valid location in the document. However I expect another error to be reported when specifying an invalid location in a mappings key (Line 21).

To reproduce...

Steps to reproduce the behavior:

  1. Copy Paste into Swagger editor

govindrai avatar Nov 17 '21 00:11 govindrai