swagger-api / swagger-api/swagger-parser

get path extension from swagger 2

Open
#1,431 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hi,
is there way how can i get extension form 'paths' level (while parse swagger 2)?

According to spec https://swagger.io/specification/v2/#pathsObject paths can contain

  • /{path} -> PathItemObject
  • ^x- -> Any

eg:

swagger: "2.0"
info:
  title: api name
  version: 1.0.0
paths:
  x-my-extension:
    type: HTTP_BACKEND
    url: https://example.com/mock
  /alerts/KS:
    get:
      description: description if operation
      responses:
        '200':
          description: Successful Response
          schema:
            type: object

Swagger.getPaths() returns Map<String, Path>, but i did not find way how to access extension.

Tried on 1.0.51

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 tracing Swagger.getPaths() and the Swagger 2 paths representation used by the parser. Check how the sample x-my-extension entry is handled during parsing; the work is done when extensions at the paths level can be accessed without losing regular path entries.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 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.