reference name is not displayed to $ref in local file

Open
#2,178 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
30/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
java
Domain
api

Research direction

Start with the openapi_test.yaml and address.yaml examples, then trace how the local $ref entries are parsed and represented before the Swagger rendering step. Reproduce the displayed output and determine whether the missing reference name originates in swagger-parser or the rendering UI; done means the responsible component is identified and the expected display behavior is covered by a test.

Written by the indexing model from the issue text.

Description

There is a simple example:

I have specification:

openapi_test.yaml:

openapi: 3.0.3
info:
  title: test
  description: test
  version: 1.0.0
servers:
  - url: '/'
tags:
  - name: test1
    description: "test"
paths:
  /test/v1/client:
    get:
      tags:
        - test1
      operationId: getClient
      responses:
        "200":
          description: "success"
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetClient200Response'


components:
  schemas:
    address:
      $ref: './address.yaml'

    GetClient200Response:
      type: object
      properties:
        address:
          $ref: '#/components/schemas/address'
        address2:
          $ref: '#/components/schemas/address2'
      required:
        - data

    address2:
      type: object
      properties:
        street:
          type: string
        building:
          type: string

./address.yaml:

type: object
properties:
  street:
    type: string
  building:
    type: string

When swagger rendering this spec it looks like:

Image

I want swagger to display referance name for all linked schemas in UI. What I do in wrong way?

Dominant language
Java
Stars
867
Forks
560
Avg merge
2d 21h
Merged PRs (30d)
7

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.

More from swagger-api/swagger-parser

All issues in swagger-api/swagger-parser

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.