Skip to content

nested relationship not displayed correctly #5972

Open
@drummerwolli

Description

@drummerwolli

Q&A (please complete the following information)

  • OS: Ubuntu
  • Browser: Chrome
  • Version: 81
  • Method of installation: https://editor.swagger.io
  • Swagger-Editor version: 3.8.0
  • Swagger/OpenAPI version: OpenAPI 3.0.2

Content & configuration

Example Swagger/OpenAPI definition:

openapi: "3.0.2"
info:
  version: "0.2"
  title: "test API"
components:
  schemas:
    User:
      allOf:
        - $ref: '#/components/schemas/BasicMixInModel'
        - $ref: '#/components/schemas/UserFullObject'
      type: object
    UserFullObject:
      allOf:
        - $ref: '#/components/schemas/UserBaseObject'
      type: object
      required:
        - id
      properties:
        id:
          type: string
    UserBaseObject:
      type: object
      properties:
        full_user_name:
          type: string
        email:
          type: string
        team_name:
          type: string
    BasicMixInModel:
      type: object
      properties:
        updated_by:
          type: string
        updated_at:
          type: string
          format: date-time
    UserList:
      type: object
      properties:
        query:
          type: string
        items:
          type: array
          items:
            $ref: "#/components/schemas/User"
paths:
  /users:
    get:
      description: "get all users. default sorted by id"
      responses:
        200:
          description: "successful operation"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UserList"

Swagger-Editor configuration options:

none

Describe the bug you're encountering

in the preview for the users GET request, not all fields are displayed.

To reproduce...

paste the above swagger file into the editor and see the rendered result.

Expected behavior

all fields should be displayed which are defined in the swagger file.

Screenshots

this is the output with missing fields:

image

also the schema is not displaying those fields:

image

interestingly enough, in the Schemas section of the editor, everything gets resolved properly:

image

Additional context or thoughts

I searched if some similar bug is/was happening already, the closest i found were swagger-api/swagger-editor#1892 and swagger-api/swagger-js#1394 but for the first one, i'm not sure if its the same issue. and changing the order also does not help here in this case.

the problem arises, when a list/array has items of objects, which are composed by other objects (referenced with allOf), which in turn also already were built out of other objects.

why do i need this? the shown swagger file is actually the condensed version of our system, which contains a user permission model. we need those different levels of inheritance to properly document also POST and PATCH requests.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions