Skip to content

Model "Title" not shown when the model is in a separate file #4678

Open
@VincentHoang

Description

@VincentHoang

SwaggerUI version (maven): 3.17.1

When I add a model to my requestBody, then it shows that model in SwaggerUI.

swagger.yaml

openapi: 3.0.0
info:
  title: my title
  description: my description
  version: 0.0.1

components:
  schemas:
    OrderRequest: 
      type: object
      properties:
        id:
          type: string
      example:
        id: "123456"

paths:
  /order:
    post:
      summary: get my order
      tags:
        - routes
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrderRequest'

As seen in the screenshot below:
model_title

However, If I move my model out to a separate file (as done below):

swagger.yaml (OrderRequest extract out)

openapi: 3.0.0
info:
  title: my title
  description: my description
  version: 0.0.1

components:
  schemas:
    OrderRequest: 
      $ref: ./models/order_request.yaml

paths:
  /order:
    post:
      summary: get my order
      tags:
        - routes
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrderRequest'

models/order_request.yaml

type: object
properties:
  id:
    type: string
example:
  id: "123456"

...then model title is not shown in the requestBody. Does anyone know why that is and what I can do to make it appear?

Screenshot

Notice that under the requestBody section, it shows the object, but doesn't label it as "OrderRequest"
no_model_title

Thanks in advanced.

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