swagger-api / swagger-api/swagger-ui

Display type(s) when using `allOf`

Open
#10,432 2 comments 0 reactions 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

When using just $ref the referenced schema is displayed.

first:
  $ref: '#/components/schemas/SomeType'

Image

But when using allOf the original schemas aren't displayed any more.

second:
  allOf:
    - $ref: '#/components/schemas/SomeType'
third:
  allOf:
    - $ref: '#/components/schemas/SomeType'
    - $ref: '#/components/schemas/SomeOtherType'

Image

Content & configuration

Swagger/OpenAPI definition:

openapi: 3.0.0
info:
 title: Testing
 version: 1.0.0
paths:
 '/':
   get:
     responses:
       200:
         description: OK
         content:
           application/json:
             schema:
               $ref: '#/components/schemas/MyObject'

components:
 schemas:
   SomeType:
     type: string
   SomeOtherType:
     type: string
   MyObject:
     type: object
     properties:
       first:
         $ref: '#/components/schemas/SomeType'
       second:
         allOf:
           - $ref: '#/components/schemas/SomeType'
       third:
         allOf:
           - $ref: '#/components/schemas/SomeType'
           - $ref: '#/components/schemas/SomeOtherType'
         
Describe the solution you'd like

It would be nice if the schema is also displayed when using allOf.

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 with the supplied OpenAPI definition and compare Swagger UI's rendering of the direct $ref property with the properties using allOf. Trace the schema display path for these two cases and verify that referenced types appear for both single- and multi-reference allOf schemas.

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
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.