-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Allow camelCase JSON properties to be accessed with PascalCase DynamicJson property accessors #34082
Merged
annelo-msft
merged 12 commits into
Azure:main
from
annelo-msft:jsondata-propertyname-casing
Feb 28, 2023
Merged
Allow camelCase JSON properties to be accessed with PascalCase DynamicJson property accessors #34082
annelo-msft
merged 12 commits into
Azure:main
from
annelo-msft:jsondata-propertyname-casing
Feb 28, 2023
Conversation
This file contains 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
annelo-msft
requested review from
JoshLove-msft,
christothes and
KrzysztofCwalina
as code owners
February 10, 2023 21:44
ghost
added
the
Azure.Core
label
Feb 10, 2023
API change check APIView has identified API level changes in this PR and created following API reviews. |
christothes
reviewed
Feb 13, 2023
annelo-msft
changed the title
[Draft] Initial work on JsonData property name casing
[Draft] Initial work on DynamicJson property name casing
Feb 14, 2023
annelo-msft
commented
Feb 14, 2023
annelo-msft
commented
Feb 14, 2023
annelo-msft
commented
Feb 14, 2023
annelo-msft
commented
Feb 14, 2023
annelo-msft
changed the title
[Draft] Initial work on DynamicJson property name casing
Initial work on DynamicJson property name casing
Feb 17, 2023
annelo-msft
changed the title
Initial work on DynamicJson property name casing
Allow camelCase JSON properties to be accessed with PascalCase DynamicJson property accessors
Feb 17, 2023
KrzysztofCwalina
approved these changes
Feb 27, 2023
christothes
reviewed
Feb 27, 2023
JoshLove-msft
approved these changes
Feb 28, 2023
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.
The primary goal of
DynamicJson
is to help developers work with Azure SDK client protocol methods. These methods essentially take and return raw JSON (RequestContent
as an input parameter andResponse.Content
as output return value), instead of strongly-typed models.DynamicJson
lets users treat these values like C# POCOs using the C#dynamic
type.One challenge of this is that Azure APIs use camelCased JSON, where C# style conventions use PascalCased property names.
This PR introduces a feature allowing callers to use PascalCased property names with DynamicJson while maintaining camelCased JSON needed for interaction with the service. It also lets callers configure DynamicJson to use strict casing, and allows service libraries to provide a configuration that works with their service in the event they need to diverge from Azure API guidelines.
In addition, callers can always use DynamicJson indexers to get and set properties with exact string matches on property names.
Addresses #33856