-
Notifications
You must be signed in to change notification settings - Fork 18
refactor!: centralize reference resolution and implement specific reference types. #203
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
also fixed up external references and streams
plus minor formatting fixes across the solution
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request includes several important changes across multiple files in the
LEGO.AsyncAPI
project. The changes primarily focus on adding copyright notices, modifying namespace imports, and enhancing theAsyncApiDiagnostic
class.Closes: #196
Licensing and Namespace Updates:
Added copyright notices:
src/LEGO.AsyncAPI.Bindings/Sns/Principal.cs
src/LEGO.AsyncAPI.Bindings/Sns/PrincipalObject.cs
src/LEGO.AsyncAPI.Bindings/Sns/PrincipalStar.cs
src/LEGO.AsyncAPI.Bindings/Sqs/PrincipalObject.cs
src/LEGO.AsyncAPI.Bindings/Sqs/PrincipalStar.cs
Removed unnecessary
using
directive:src/LEGO.AsyncAPI.Bindings/Sns/Statement.cs
src/LEGO.AsyncAPI.Bindings/Sqs/Statement.cs
Code Enhancements:
Modified
SnsOperationBinding
class to usethis.identifierFixFields
:src/LEGO.AsyncAPI.Bindings/Sns/SnsOperationBinding.cs
Added
Append
method toAsyncApiDiagnostic
class:src/LEGO.AsyncAPI.Readers/AsyncApiDiagnostics.cs
Refactoring:
Removed
AsyncApiExternalReferenceResolver
class:src/LEGO.AsyncAPI.Readers/AsyncApiExternalReferenceResolver.cs
(Fa207344R1)Refactored
AsyncApiJsonDocumentReader
to use instancecontext
:src/LEGO.AsyncAPI.Readers/AsyncApiJsonDocumentReader.cs
[1] [2] [3] [4] [5] [6]Reference implementations has changed
Changed References to be dereferenced through a 'workspace' type.
Resolved references are cached here for later, and referenced through the new reference types specifically.
References are still resolved at read time however, due to constraints in how the project align with eachother.
The core Reference type, has been amended to return more 'correct' output, in terms of what used to be the 'Id' which in reality was supposed to be the fragment identifier.
External Reference resolution
External references will now be resolved, as many turtles down as is required.
The reference streams (original documents) are cached in the workspace, in case there are multiple fragmented references to them.
All external references are forced to json (from yaml) and json-pointers are used for fragment lookups.
This means that you can technically reference yaml documents from a json asyncapi document, and vice versa, but this should be seen more as a feature than anything else.
external uri's are expected to be prefixed with either
file://
orhttp(s)://
.A custom StreamLoader can be implemented if something different is needed.
Stream output is expected to be yaml or json.
Fragments
Fragments are now fully resolved, across the document if needed - not just components.
this means that you can now reference other parts of the document if needed.
like this.
Fixes
This also fixes a few missing reference resolution paths;
BREAKING CHANGE:
References
References are now specific types that decorator the original type.
This means 2 things.
Changed from
To
SecurityRequirements
which still reference components through the scheme name rather than the components location.)Renames
AvroSchema
has been renamed toAsyncApiAvroSchema
to denote the top level abstract as a specific AsyncApi Class.Others
The concrete payload types has been removed, as these posed unneeded complexity for the library consumers.
Particularly with references.
Now the
AsyncApiAvroSchema
andAsyncApiJsonSchema
types can be used directly as message payloads.