feat: Newtonsoft.Json → System.Text.Json + .NET 10 Upgrade on contentstack-model-generator#49
Merged
Conversation
back merge
update: added skill files
- Bump main project TFM from net7.0 to net10.0 - Bump test project TFM from net9.0 to net10.0 - Update Microsoft.AspNetCore.Mvc.Testing 9.0.9 → 10.0.0 - Upgrade CI: actions/checkout@v1 → @v4, setup-dotnet@v3 → @v4 with dotnet-version 10.x - Fix pre-existing GetHeader visibility private → internal (unblocks 175 tests) - Bump PackageVersion and ReleaseVersion to 1.0.0-beta.1 - Update CHANGELOG.md
…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
feat: upgrade to .NET 10 and bump version to 1.0.0-beta.1
feat: migrate internal model DTOs from [JsonProperty] to [JsonPropertyName]
Replace all Newtonsoft usage across the HTTP abstraction layer as part of the STJ migration. Renames OpenJObjectResponse() to OpenJsonObjectResponse() returning System.Text.Json.Nodes.JsonObject, swaps JsonSerializer (Newtonsoft) for JsonSerializerOptions throughout the request/response pipeline, and replaces JsonConvert.SerializeObject with JsonSerializer.Serialize for query param building. Files changed: - CMA/Http/IResponse.cs - CMA/Http/ContentstackResponse.cs - CMA/HTTPRequestHandler.cs - CMA/Http/ContentstackHttpRequest.cs
…ization in OAuthService and tests
…ContentstackClient
…ration refactor: migrate from Newtonsoft.Json to System.Text.Json for serialization in OAuthService and tests
feat: migrate HTTP layer from Newtonsoft.Json to System.Text.Json
refactor: update serializer settings to use JsonSerializerOptions in ContentstackClient
…tes to System.Text.Json - Remove the Newtonsoft.Json 13.0.3 PackageReference from contentstack.model.generator.csproj now that tool internals no longer depend on it - Update ModelGenerator.cs's _templateStart, CreateLinkClass(), CreateFile(), and AddParams() to emit [JsonPropertyName] instead of [JsonProperty], and swap the Newtonsoft using statements in _templateStart for System.Text.Json / Nodes / Serialization Note: CreateEmbeddedObjectClass() and CreateModularBlockConverter() still reference Newtonsoft types (JObject/JArray) for their converter templates and are not yet migrated, so the project will not build again until that work lands.
refactor: remove Newtonsoft.Json package and migrate template attributes to System.Text.Json
- Update CreateHelperClass()'s emitted FieldExists signature from JObject to JsonObject - Rewrite CreateModularBlockConverter()'s emitted converter from Newtonsoft's ReadJson()/WriteJson()/serializer.Populate() to STJ's Read()/Write(), using a parse-then-deserialize-and-replace pattern that restores the BlockType discriminator after re-deserializing the concrete block type
refactor: migrate modular block converter template to System.Text.Json
refactor: migrate from Newtonsoft.Json to System.Text.Json in ModelGenerator
…ested CMA/Model classes
test: expand unit test coverage for ModelGenerator and previously-untested CMA/Model classes
feat: Update the Read me and version bump for Major Release
|
We regret to inform you that you are currently not able to merge your changes into the master branch due to restrictions applied by our SRE team. To proceed with merging your changes, we kindly request that you create a pull request from the staging branch. Our team will then review the changes and work with you to ensure a successful merge into the master branch. |
|
We regret to inform you that you are currently not able to merge your changes into the master branch due to restrictions applied by our SRE team. To proceed with merging your changes, we kindly request that you create a pull request from the staging branch. Our team will then review the changes and work with you to ensure a successful merge into the master branch. |
reeshika-h
approved these changes
Jul 13, 2026
cs-raj
approved these changes
Jul 13, 2026
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.
Breaking Changes:
Newtonsoft.Jsondependency entirely. Both the tool's internals and the models/converters it generates now useSystem.Text.Json.[JsonPropertyName]instead of[JsonProperty], and referenceSystem.Text.Json/System.Text.Json.Nodes/System.Text.Json.Serializationinstead ofNewtonsoft.Json.System.Text.Json.Serialization.JsonConverter<T>(Read/Write) instead of Newtonsoft'sJsonConverter<T>(ReadJson/WriteJson). Regenerating models against an existing project will change these attributes and converters - update consuming code accordingly.ContentstackExceptionno longer supports legacyBinaryFormatter-based serialization (removed the obsoleteSerializationInfo/StreamingContextconstructor andGetObjectDataoverride).Enhancements:
[JsonProperty]to[JsonPropertyName].System.Text.Json.JObjecttoSystem.Text.Json.Nodes.JsonObject.System.Text.Json(JsonSerializerOptions,JsonNode).System.Text.Json-based generated code.GetDatatypeForContentType) to useSystem.Text.Json.JsonElementinstead of the removed NewtonsoftJArray/JObjecttypes.Bug fix:
embeddedItemsproperty's nullable annotation was emitted as literal text ({nullableString()}) instead of being applied, for content types with RTE-embedded references.