question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[FR]: Support path-based $refs when resolving OpenAPI Specs

See original GitHub issue

Is your feature request related to a problem? Please describe.

I’d like to use this on OpenAPI Specs that use the $ref feature to refer to definitions from other files, such that large APIs can be split into multiple files for reuse/readability purposes.

Presently, this library only supports $refs within the same file.

https://github.com/contiamo/restful-react/blob/45d0ef61b5b0894d3f7da7c66e6fd1c1c98e62b1/src/scripts/import-open-api.ts#L93

Describe the solution you’d like

Ability to use multi-file OpenAPI specs, since I’m trying to making them with https://stoplight.io/studio

Describe alternatives you’ve considered

I wonder if there are any OpenAPI tools that can rewrite a spec that uses path based $refs such that all the content gets imported into 1 file under the “components” key, for the benefit of tools that aren’t designed to work with multi-file OpenAPI specifications such as this one.

Additional context Add any other context or screenshots about the feature request here.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:2
  • Comments:5

github_iconTop GitHub Comments

2reactions
hydrosquallcommented, Jan 29, 2020

Noticed today that the latest https://www.npmjs.com/package/swagger-parser might work better than swagger-cli, since it’s compatible with external files, but unlike swagger-cli, supports working with circular references (which was necessary for working with recursive data types)

2reactions
hydrosquallcommented, Dec 24, 2019

Workaround obtained via my coworker: swagger-cli stitched together my files, e.g.

swagger-cli bundle my_open_api_spec.yaml -t yaml > resolved_api_spec.yaml

https://www.npmjs.com/package/swagger-cli

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using $ref - Swagger
OAS 3 This guide is for OpenAPI 3.0. Using $ref. When you document an API, it is common to have some features which...
Read more >
Splitting specification file - API Handyman
Splitting a specification file will help to keep it maintainable by creating smaller files and also help to ensure consistency throughout APIs ...
Read more >
$ref is not resolved when path contains "~1" (escaped slash)
As per openapi specs ... Latest version of extension doesn't support "go to definition" if path contains ~1. Here is an example repository ......
Read more >
Step 5: The components object (OpenAPI tutorial)
The components object is unique from the other objects in the OpenAPI specification. In components, you store re-usable definitions that ...
Read more >
Resolving Overloaded Terms for API Specifications ...
API Specification — A technical standard, like OpenAPI 3.0, ... Spectral will get an — external switch and that'll support refs that hit...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found