-
Notifications
You must be signed in to change notification settings - Fork 18
feat(references)!: add basic scaffolding for external ref resolution #168
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
## About the PR Fixes some issues with working with AsyncApiAny, figuring out the correct types etc. Added new GetValue type methods for extracting expected values. These use `system.text.json` to deserialize to `T` from the `JsonNode` type. Added a static FromExtension method, to remove redundant type casting. So instead of ```csharp if (TryGetValue(key, out IAsyncApiExtension extension)) { var myType = (extension as AsyncApiAny).GetValue<MyType>(); } ``` You do ```csharp if (TryGetValue(key, out IAsyncApiExtension extension)) { var myType = AsyncApiAny.FromExtensionOrDefault<MyType>(extension); } ``` Added new constructor allowing for much simpler `AsyncApiAny` initialization, utlizing `system.json.text` to figure out the JsonNode type. ### Changelog - Added: `GetValue<T>()` - Added: `GetValueOrDefault<T>()` - Added: `TryGetValue<T>()` - Added: static `FromExtensionOrDefault<T>(IAsyncApiExtension extension)` - Added: new constructor to allow for easier object creation. - Obsoleted: `AsyncApiArray` - Obsoleted: `AsyncApiObject`
Co-authored-by: Alex Wichmann <VisualBean@users.noreply.github.com>
dpwdec
commented
May 2, 2024
VisualBean
reviewed
May 7, 2024
VisualBean
reviewed
May 7, 2024
VisualBean
reviewed
May 8, 2024
VisualBean
reviewed
May 8, 2024
src/LEGO.AsyncAPI.Readers/Interface/IAsyncApiExternalReferenceReader.cs
Outdated
Show resolved
Hide resolved
VisualBean
reviewed
May 8, 2024
@VisualBean I think I've addressed most things now. Just let me know if there's anything else. |
VisualBean
approved these changes
May 15, 2024
VisualBean
pushed a commit
that referenced
this pull request
Jun 14, 2024
…168) Co-authored-by: lego-10-01-06[bot] <119427331+lego-10-01-06[bot]@users.noreply.github.com> Co-authored-by: Alex Wichmann <VisualBean@users.noreply.github.com> Co-authored-by: gokerakc <gokerakce@outlook.com> Co-authored-by: VisualBean <alekcarlsen@gmail.com> Co-authored-by: Byron Mayne <Byronmayne@gmail.com> Co-authored-by: James Thompson <thompson.tomo@outlook.com> Co-authored-by: dec.kolakowski <dec.kolakowski@justeattakeaway.com> BREAKING CHANGE: Change the `ReferenceResolution` enum.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
asyncapi.models
asyncapi.readers
asyncapi.tests
documentation
Improvements or additions to documentation
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.
About the PR
Adds basic scaffolding for resolving external references.
BREAKING CHANGE: Change the
ReferenceResolution
enum.