Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support for ref aliases when resolving components #162

Merged
merged 1 commit into from
Mar 14, 2022

Conversation

cmars
Copy link
Contributor

@cmars cmars commented Mar 14, 2022

[Backport of #161 into 3.x]

This adds minimal support for JSON References, section 4.1[0] in which a
$ref prefix can resolve through another $ref in the JSON document.

It is not a complete implementation of this specification, but enough of
one to be useful for resolving OpenAPI components. Limitations:

  • Reference prefixes may only be defined as a component extension.
  • A single substitution pass is performed on the document only once.
  • Therefore, only a single level of indirection is supported.

Drive-bys:

  • Replace the Localize implementation with openapi3/T.InternalizeRefs.

This adds minimal support for JSON References, section 4.1[0] in which a
$ref prefix can resolve through another $ref in the JSON document.

It is not a complete implementation of this specification, but enough of
one to be useful for resolving OpenAPI components. Limitations:
- Reference prefixes may only be defined as a component extension.
- A single substitution pass is performed on the document only once.
- Therefore, only a single level of indirection is supported.

Drive-bys:
- Replace the Localize implementation with openapi3/T.InternalizeRefs.
@cmars cmars requested a review from a team as a code owner March 14, 2022 15:19
@cmars cmars merged commit 618987c into snyk:v3 Mar 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant