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(references)!: add basic scaffolding for external ref resolution #168

Merged
merged 40 commits into from
May 15, 2024

Conversation

dpwdec
Copy link
Contributor

@dpwdec dpwdec commented Apr 19, 2024

About the PR

Adds basic scaffolding for resolving external references.

BREAKING CHANGE: Change the ReferenceResolution enum.

lego-10-01-06 bot and others added 23 commits December 14, 2023 15:02
## 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`
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Apr 30, 2024
@dpwdec dpwdec marked this pull request as ready for review April 30, 2024 13:34
@dpwdec dpwdec changed the title DRAFT - feat: add basic scaffolding for external ref resolution feat: add basic scaffolding for external ref resolution Apr 30, 2024
@dpwdec
Copy link
Contributor Author

dpwdec commented May 9, 2024

@VisualBean I think I've addressed most things now. Just let me know if there's anything else.

@VisualBean VisualBean changed the title feat: add basic scaffolding for external ref resolution feat!: add basic scaffolding for external ref resolution May 13, 2024
@VisualBean VisualBean changed the title feat!: add basic scaffolding for external ref resolution feat(references)!: add basic scaffolding for external ref resolution May 13, 2024
@dpwdec dpwdec changed the base branch from main to vnext May 15, 2024 10:18
@VisualBean VisualBean merged commit 80931cc into LEGO:vnext May 15, 2024
15 checks passed
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 <[email protected]>
Co-authored-by: gokerakc <[email protected]>
Co-authored-by: VisualBean <[email protected]>
Co-authored-by: Byron Mayne <[email protected]>
Co-authored-by: James Thompson <[email protected]>
Co-authored-by: dec.kolakowski <[email protected]>

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants