swagger-api / swagger-api/swagger-ui

OpenAPI 3.1.0 support: Individual path method reference not resolving.

Open
#8,955 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

Q&A (please complete the following information)
Content & configuration

Swagger/OpenAPI definition:

In oas_paths.yaml:
openapi: 3.1.0
info:
  version: 1.0.0
  title: Customer Paths
paths:
  "/customer":
    get:
      ...

    post:
      ...

In oas_main.yaml:
openapi: 3.1.0
info:
  version: 1.0.0
  title: Customers

paths:
  # This works, including both the get and post methods for this path.
  "/customer":
    $ref: './oam_paths.yaml#/paths/~1customer'

  # This does NOT work to include just the get method:
  "/customer":
    get:
      $ref: './oam_paths.yaml#/paths/~1customer/get'

Swagger-UI configuration options:

Using out-of-the-box docker image.

In docker-compose file:

image: swaggerapi/swagger-ui:v5.1.0
?yourQueryStringConfig
Screenshots

image

How can we help?

When I use https://www.npmjs.com/package/@apidevtools/swagger-parser to bundle the spec into a single document, I can include just the get method and it renders as expected using swagger-ui, so is this a bug in swagger-ui that it is not resolving this reference correctly?

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

Reproduce the report with the Swagger UI v5.1.0 Docker image and the two OpenAPI 3.1.0 YAML examples. Start by tracing how Swagger UI resolves the individual GET reference, then verify that the referenced method renders while the whole-path reference continues to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, openapi
Domain
api, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.