zalando / intellij-swagger

A plugin to help you easily edit Swagger and OpenAPI specification files inside IntelliJ IDEA

Home Page:https://plugins.jetbrains.com/plugin/8347

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Merge keys are handled incorrectly in SwaggerUI view

lfyuomr-gylo opened this issue · comments

Consider the following OpenAPI definition, containing YAML Merge keys with anchor references:

openapi: 3.0.0
info:
  title: "Merge keys sample"
  description: "This is a sample OpenAPI specification with YAML Merge Keys feature used."
  version: snapshot

components:
  schemas:
    SelectionOption: &SelectionOption
      type: object
      required:
        - id
        - label
      properties:
        id:
          type: string
          nullable: false
          description: An internal unique identifier, which should be used for any communication with the backend.
        label:
          type: string
          nullable: false
          description: A human-readable name which should be shown to a user instead of the `id`.
          readOnly: true

paths:
  /foo/bar:
    get:
      summary: Blah blah
      responses:
        200:
          description: Blah blah
          content:
            application/json:
              schema:
                type: object
                properties:
                  foo:
                    <<: *SelectionOption
                    description: "This is description of `foo` field"
                  bar:
                    <<: *SelectionOption
                    description: "Here is description of bar field"

If I open this definition in my IntelliJ and then click open in browser button, I get a SwaggerUI page with wrong response schema:
image

It seems like the Merge key is just ignored in my OpenAPI definition, even though it's handled properly both by editor.swagger.io and by SwaggerUI 3.22.3:
image

I suppose it could be related to #87 and may be caused by the well-known Jackson limitation.


My environment:

  • IntelliJ IDEA 2019.2
  • Swagger plugin v 1.0.27
  • Google Chrome 70.0.3538.77 (64-bit) for Linux