Skip to content

Conversation

@MaggieKimani1
Copy link
Contributor

@MaggieKimani1 MaggieKimani1 commented Mar 25, 2024

This PR:

  • Proposes the use of proxy reference objects to resolve both local and external references present in an OpenAPI document. A proxy reference class inherits the properties and methods of the class it proxies and is used to lazily retrieve the reference property values of its target.
  • The proxy reference models use a host OpenApi document instance passed in their constructor in order to find the target the $refs point to and dereferences them lazily.
  • Initially, we had a 2-step process where we load up a document in memory then have a second pass where we walk through the document and use an OpenApiReferenceResolver visitor to locate and resolve references. With this approach, the second pass includes walking through the document instance and using a HostDocumentResolver visitor that visits all proxy reference objects and sets the value of the host document.

To note:

  • If one tries to parse a document fragment, they'll need to provide a host document value otherwise reference resolution fails.

Fixes #1571

MaggieKimani1 and others added 30 commits February 26, 2024 11:48
…to mk/use-proxy-reference-for-ref-resolution
…ost document in the proxy Reference's property
@MaggieKimani1 MaggieKimani1 changed the title Use proxy references to resolve both local and external $refs lazily Use proxy references to resolve references Mar 25, 2024
ExternalResource = externalResource
};

Reference = _reference;

Check warning

Code scanning / CodeQL

Virtual call in constructor or destructor

Avoid virtual calls in a constructor or destructor.
@MaggieKimani1 MaggieKimani1 self-assigned this Apr 3, 2024
@MaggieKimani1 MaggieKimani1 merged commit c1b1616 into release/2.0.0 Apr 3, 2024
@MaggieKimani1 MaggieKimani1 deleted the mk/use-proxy-reference-for-ref-resolution branch April 3, 2024 13:30
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.

4 participants