swagger-api / swagger-api/swagger-ui
Hide example from Inline Models in Respones
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
| Q | A |
|---|---|
| Bug or feature request? | feature request |
| Which Swagger/OpenAPI version? | 3.0.0 |
| Which Swagger-UI version? | 3.13.6 gcbff0251 |
| How did you install Swagger-UI? | npm run build |
| Which browser & version? | na |
| Which operating system? | na |
Problem
When example is provided in the schema of the Media object, it is being read correctly, and the "Example Value" box is filled in. HOWEVER, if you click "Model", you can also see your example field listed there, in gray-ed out color, and it's very confusing.
I'm providing 2 samples, one simple (where it's not that much of an issue), one more complex (where it's becoming a pain).
Am I missing something?
Demonstration API definition
Simple case:
openapi: "3.0.0"
info:
title: Schema Example Test
version: v2
description: Schema Example
paths:
/:
get:
operationId: main
responses:
'200':
content:
application/json:
schema:
type: integer
example: 12

More complex version:
openapi: "3.0.0"
info:
title: Schema Example Test
version: v2
description: Schema Example
paths:
/:
get:
operationId: main
responses:
'200':
content:
application/json:
schema:
type: array
items:
type: object
properties:
id:
type: integer
name:
type: string
example:
id: 1
name: Dog

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 with the two OpenAPI 3.0.0 definitions and compare how the Example Value and Model views render their schema examples. The work is done when a schema example remains visible in Example Value but is no longer listed in the Model view, including the array and object case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100