Skip to content

feat: migrate internal model DTOs from [JsonProperty] to [JsonPropertyName]#40

Merged
OMpawar-21 merged 2 commits into
enhc/betafrom
enhc/DX-9374
Jul 1, 2026
Merged

feat: migrate internal model DTOs from [JsonProperty] to [JsonPropertyName]#40
OMpawar-21 merged 2 commits into
enhc/betafrom
enhc/DX-9374

Conversation

@OMpawar-21

Copy link
Copy Markdown

Summary

  • Migrates all internal model DTOs from Newtonsoft.Json [JsonProperty] attributes to System.Text.Json [JsonPropertyName] attributes
  • Removes using Newtonsoft.Json imports from all affected model files

Changes

File Change
Model/Field.cs [JsonProperty][JsonPropertyName], using Newtonsoft.Jsonusing System.Text.Json.Serialization
Model/MetaData.cs Same pattern
Model/Contenttype.cs Same pattern
Model/StackResponse.cs Same pattern
Model/OAuth.cs Same pattern across OAuthAppAuthorizationResponse, OAuthAppAuthorizationData, OAuthUser, OAuthResponse
CMA/ContentStackError.cs Same pattern across ErrorMessage, ErrorCode, Errors properties
CMA/OAuth/OAuthService.cs [JsonProperty][JsonPropertyName] on OAuthTokenResponse class properties

Notes

  • Zero logic changes — purely attribute and import replacements
  • All JSON key string values are unchanged, preserving exact API field mappings
  • OAuthService.cs retains using Newtonsoft.Json as JsonConvert deserialization calls are addressed in a follow-up PR

Test Plan

  • dotnet build — 0 errors
  • dotnet test — 175 passed, 0 failed

…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
@OMpawar-21 OMpawar-21 requested a review from reeshika-h July 1, 2026 06:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.Json to System.Text.Json.Serialization.
  • Updated OAuthTokenResponse in OAuthService.cs to 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.

Comment thread contentstack.model.generator/Model/StackResponse.cs
Comment thread contentstack.model.generator/Model/Contenttype.cs
Comment thread contentstack.model.generator/Model/Field.cs
Comment thread contentstack.model.generator/Model/MetaData.cs
Comment thread contentstack.model.generator/CMA/OAuth/OAuthService.cs
@OMpawar-21 OMpawar-21 marked this pull request as ready for review July 1, 2026 07:24
@OMpawar-21 OMpawar-21 requested a review from a team as a code owner July 1, 2026 07:24
@OMpawar-21 OMpawar-21 merged commit 8440549 into enhc/beta Jul 1, 2026
8 checks passed
@OMpawar-21 OMpawar-21 deleted the enhc/DX-9374 branch July 1, 2026 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants