feat: migrate internal model DTOs from [JsonProperty] to [JsonPropertyName]#40
Merged
Conversation
…yName] - Replace Newtonsoft.Json [JsonProperty] with STJ [JsonPropertyName] in: Field.cs, MetaData.cs, Contenttype.cs, StackResponse.cs, ContentStackError.cs, OAuth.cs, OAuthService.cs (OAuthTokenResponse class) - Swap using Newtonsoft.Json → using System.Text.Json.Serialization in all above files - Migrate Model/OAuth.cs (OAuthAppAuthorizationResponse, OAuthAppAuthorizationData, OAuthUser, OAuthResponse) - OAuthService.cs retains using Newtonsoft.Json for JsonConvert calls
reeshika-h
approved these changes
Jul 1, 2026
There was a problem hiding this comment.
Pull request overview
This PR aims to migrate internal DTO JSON-mapping attributes from Newtonsoft.Json ([JsonProperty]) to System.Text.Json ([JsonPropertyName]) and remove using Newtonsoft.Json from the affected model files.
Changes:
- Replaced
[JsonProperty(...)]with[JsonPropertyName(...)]across several DTOs (keeping JSON key strings the same). - Swapped model-file imports from
Newtonsoft.JsontoSystem.Text.Json.Serialization. - Updated
OAuthTokenResponseinOAuthService.csto use[JsonPropertyName].
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| contentstack.model.generator/Model/Field.cs | Migrates field DTO attributes/imports to JsonPropertyName. |
| contentstack.model.generator/Model/MetaData.cs | Migrates metadata DTO attributes/imports to JsonPropertyName. |
| contentstack.model.generator/Model/Contenttype.cs | Migrates reference_to mapping to JsonPropertyName. |
| contentstack.model.generator/Model/StackResponse.cs | Migrates stack response mappings to JsonPropertyName. |
| contentstack.model.generator/Model/OAuth.cs | Migrates OAuth DTO attributes/imports to JsonPropertyName. |
| contentstack.model.generator/CMA/ContentStackError.cs | Migrates error DTO attributes/imports to JsonPropertyName. |
| contentstack.model.generator/CMA/OAuth/OAuthService.cs | Migrates OAuthTokenResponse attributes to JsonPropertyName (while file still uses JsonConvert). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
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.
Summary
[JsonProperty]attributes to System.Text.Json[JsonPropertyName]attributesusing Newtonsoft.Jsonimports from all affected model filesChanges
Model/Field.cs[JsonProperty]→[JsonPropertyName],using Newtonsoft.Json→using System.Text.Json.SerializationModel/MetaData.csModel/Contenttype.csModel/StackResponse.csModel/OAuth.csOAuthAppAuthorizationResponse,OAuthAppAuthorizationData,OAuthUser,OAuthResponseCMA/ContentStackError.csErrorMessage,ErrorCode,ErrorspropertiesCMA/OAuth/OAuthService.cs[JsonProperty]→[JsonPropertyName]onOAuthTokenResponseclass propertiesNotes
OAuthService.csretainsusing Newtonsoft.JsonasJsonConvertdeserialization calls are addressed in a follow-up PRTest Plan
dotnet build— 0 errorsdotnet test— 175 passed, 0 failed