swagger-api / swagger-api/swagger-ui
$ref pointing to a field in the same object is rendered as string
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
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:
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:
- Open the API definition in Swagger UI
- Click on „GET /”
- Look at the example
- See
"fetcher": "string" - Click on Schemas -> LinkScheduled
- Click on „Explore“ to reload the definition
- See
"fetcher": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
Expected behavior
The „fetcher“ field is rendered as "fetcher": "3fa85f64-5717-4562-b3fc-2c963f66afa6".
Screenshots


Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue in Swagger UI and Swagger Editor with the OpenAPI 3.0 definition from the report. Compare the initial rendering of the fetcher field with the rendering after Schemas → LinkScheduled → Explore; done means the field consistently renders the UUID example without requiring a reload.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 64/100