#8228·swagger-ui

$ref pointing to a field in the same object is rendered as string

Author: belka-ewCreated Oct 14, 2022Updated Aug 13, 2026

Q&A

  • OS: Linux
  • Browser: Firefox
  • Version: 106.0b9
  • Method of installation: Docker
  • Swagger-UI version: 4.14.3
  • Swagger/OpenAPI version: OpenAPI 3.0

Content & configuration

I see the behaviour in the Swagger UI and Swagger Editor.

Example Swagger/OpenAPI definition:

yaml
openapi: 3.0.0
info:
  version: 1.0.0
  title: Title
paths:
  /:
    get:
      responses:
        '200':
          description: 'OK'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LinkScheduled'
components:
  schemas:
    LinkScheduled:
      type: object
      properties:
        feeder:
          type: string
          format: uuid
        fetcher:
          $ref: '#/components/schemas/LinkScheduled/properties/feeder'

Describe the bug you're encountering

$ref pointing to a property in the same object is rendered as string even if it is not a string. If I open a type in the schema and reload the schema (with „Explore“ button in the Swagger UI) the field is rendered correctly, and the later reloads keep the correct field.

To reproduce...

Steps to reproduce the behavior:

  1. Open the API definition in Swagger UI
  2. Click on „GET /”
  3. Look at the example
  4. See "fetcher": "string"
  5. Click on Schemas -> LinkScheduled
  6. Click on „Explore“ to reload the definition
  7. See "fetcher": "3fa85f64-5717-4562-b3fc-2c963f66afa6"

Expected behavior

The „fetcher“ field is rendered as "fetcher": "3fa85f64-5717-4562-b3fc-2c963f66afa6".

Screenshots

before after