You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 9063f4e
Browse filesBrowse the repository at this point in the historyBrowse files
## 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`
0 commit comments