swagger-api / swagger-api/swagger-ui

discriminator: resouce_type does not show in UI

Open
#8,200 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

Content & configuration

Hi I'm using discriminator: resouce_type in my YAML for some of the definitions. They are not showing on UI. Can someone please help, is it supported in swagger UI or Am I doing something wrong..

Swagger/OpenAPI definition:

definitions:
 myModel:
   allOf:
     - $ref: '#/definitions/ResponseWrapper'
     - type: object
   type: object
   properties:
     field1:
       type: number
       format: string
       description: "My field 1"
     field2:
       type: string
       description: "My field 2"
       
 ResponseWrapper:
   allOf:
     - type: object
       discriminator: resouce_type

Swagger-UI configuration options:

SwaggerUI({
   "library": "spring-mvc",
   "dateLibrary": "legacy",
   "hideGenerationTimestamp": true,
   "modelPackage": "com.example",
   "apiPackage": "com.example",
   "useTags": true,
   "importMappings": {
   	"ResponseWrapper": "com.example.ResponseWrapper"
   }
}
)

Is your feature request related to a problem?

image

Describe the solution you'd like

Can swagger read those classes from classpath and resolve and show in UI.?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by loading the supplied YAML definition in Swagger UI and verify whether the discriminator is valid and supported. Trace how the ResponseWrapper and myModel definitions are rendered in the UI. Done means the supported discriminator is visible for the model, or the UI clearly reports why this definition cannot be rendered.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.