Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
ca06d6b
feat: Migration changes
OMpawar-21 May 11, 2026
fc3a281
Revert "feat: Migration changes"
OMpawar-21 May 15, 2026
1893f52
feat: Add System.Text.Json support for ContentstackClient, Login, Org…
OMpawar-21 May 18, 2026
9123c18
fix: Update regex in check-version-bump.yml to support semantic versi…
harshitha-cstk May 18, 2026
04e9a9c
feat: Removed Newtonsoft.Json package from test files
OMpawar-21 May 18, 2026
8d17ff5
feat: Version Bump
OMpawar-21 May 18, 2026
9be3052
feat: Removed Newtonsoft.json from Contentstack.Management.Core.Unit.…
OMpawar-21 May 18, 2026
63b0bcc
fix: corrected version bump
OMpawar-21 May 18, 2026
82f0e97
Merge pull request #173 from contentstack/enhc/DX-7292
OMpawar-21 May 18, 2026
ae1e9a0
feat: Complete Migration on Client, User, Org, Stack module
OMpawar-21 May 19, 2026
1727b77
feat: Added version bump
OMpawar-21 May 19, 2026
b6585d2
fix: add nullable annotations to resolve warnings
OMpawar-21 May 19, 2026
312a8c2
fix: Github warning for Contentstackclient
OMpawar-21 May 19, 2026
d4c0168
fix: resolved warning for Stack.cs
OMpawar-21 May 19, 2026
5673d9e
fix: resolve fix for Query.cs
OMpawar-21 May 19, 2026
0317c88
Merge pull request #174 from contentstack/enhc/DX-7293
OMpawar-21 May 19, 2026
c37d1b9
refactor: update JSON handling in DeliveryToken tests and models to u…
reeshika-h May 19, 2026
0ba1924
feat: ContentType & QueryService STJ Migration
OMpawar-21 May 19, 2026
7670f60
feat: Migrate core Field models for ContentType support
OMpawar-21 May 19, 2026
6586804
feat: fixed github warning - Cannot convert null literal to non-nulla…
OMpawar-21 May 20, 2026
686c282
feat: fixed the warning for Stack.cs
OMpawar-21 May 20, 2026
f36bff1
refactor: remove unused Newtonsoft.Json dependency from DeliveryToken…
reeshika-h May 20, 2026
5f7a8e3
feat: Complete Assets module STJ migration
OMpawar-21 May 20, 2026
c7b1d59
feat: fixed the wraning -> "Cannot convert null literal to non-nullab…
OMpawar-21 May 20, 2026
dd9847f
feat: migrate Environment and Global Field modules to System.Text.Json
OMpawar-21 May 20, 2026
83c9b6b
feat: Added Version bump
OMpawar-21 May 20, 2026
257c07f
refactor: replace Newtonsoft.Json with System.Text.Json in Taxonomy a…
reeshika-h May 21, 2026
7807e2b
Merge pull request #177 from contentstack/enhc/DX-7304
sunil-lakshman May 22, 2026
1531fa2
Merge pull request #175 from contentstack/enh/DX-7295-migration
sunil-lakshman May 22, 2026
66ff319
Merge pull request #178 from contentstack/enhc/DX-7298
sunil-lakshman May 22, 2026
6a8733b
Merge pull request #179 from contentstack/enh/DX-7299-taxonomy-term-m…
sunil-lakshman May 22, 2026
63895ff
feat: migrate Entry, Entry Variant and Variant Group modules to Syste…
OMpawar-21 May 22, 2026
e999cd3
Merge pull request #180 from contentstack/enhc/DX-7589
sunil-lakshman May 25, 2026
25ef701
feat: Miragted unit test cases and Intgration test cases to STJ
OMpawar-21 May 25, 2026
7986576
Merge pull request #181 from contentstack/enhc/DX-8549
OMpawar-21 May 26, 2026
006d612
feat: correctly mention the version bump and updated the dotnet version
OMpawar-21 May 26, 2026
814445e
feat: correct version bump and dotnet version updated
OMpawar-21 May 26, 2026
7a5c1cd
Merge pull request #182 from contentstack/enhc/DX-corrected-version
OMpawar-21 May 26, 2026
58bdc42
Refactor Workflow Tests and Services to Use System.Text.Json
reeshika-h May 26, 2026
af9a7dd
feat: migrate Locale and Bulk Operations to STJ, upgrade to .NET 10, …
OMpawar-21 May 27, 2026
dc598c4
refactor: migrate WebhookModel to use System.Text.Json for serialization
reeshika-h May 27, 2026
ef37861
Merge pull request #183 from contentstack/enh/DX-7307-workflow-migration
reeshika-h May 27, 2026
673b7c7
Merge pull request #185 from contentstack/enh/DX-7309-webhook-migration
reeshika-h May 27, 2026
ecdf171
Merge branch 'enhc/beta' into enhc/DX-7303
OMpawar-21 May 27, 2026
9cd266a
Merge pull request #184 from contentstack/enhc/DX-7303
OMpawar-21 May 27, 2026
cc1215d
refactor: update exception handling in model tests to use ArgumentExc…
reeshika-h May 27, 2026
10ec355
Merge branch 'enhc/beta' into enh/DX-8558-tests-migration
reeshika-h May 27, 2026
987b8af
refactor: update WorkflowTest assertions to use GetValue for JSON pro…
reeshika-h May 28, 2026
c1d9aff
feat: migrate Release, Workflow, PublishQueue & PublishRule modules t…
OMpawar-21 May 28, 2026
f05d48b
refactor: update models to use nullable string parameters for uid and…
reeshika-h May 29, 2026
175768f
Added branches support
sunil-lakshman May 29, 2026
92fffdd
feat: Added some fixes for test cases.
OMpawar-21 May 31, 2026
4efa540
fix: Mark PublishQueue and PublishRule params nullable
OMpawar-21 Jun 1, 2026
4959457
feat: Add nullable annotations to model method parameters
OMpawar-21 Jun 1, 2026
84b0328
fix: Annotate nullable ParameterCollection and uid
OMpawar-21 Jun 1, 2026
236fef2
fix: Fixed warning for nullables
OMpawar-21 Jun 1, 2026
d55fc73
fix: Stack.cs warnings
OMpawar-21 Jun 1, 2026
98f9e1a
Merge pull request #189 from contentstack/enh/dx-8564
sunil-lakshman Jun 1, 2026
318c6d7
Merge pull request #187 from contentstack/enhc/DX-7306-release-module
OMpawar-21 Jun 1, 2026
be6774e
fix: migrate PublishRuleModel to STJ, fix bulk workflow setup, fix fl…
reeshika-h Jun 1, 2026
92665a3
Merge branch 'enhc/beta' into enh/DX-8558-tests-migration
reeshika-h Jun 1, 2026
db62f73
fix: remove stale comment block that was hiding DeliveryToken and Man…
reeshika-h Jun 1, 2026
f1df975
feat: Migrate SDK from Newtonsoft.Json to System.Text.Json
OMpawar-21 Jun 2, 2026
771bf58
Merge pull request #188 from contentstack/enh/DX-8558-tests-migration
reeshika-h Jun 2, 2026
6e6352a
refactor: migrate RoleModel and related tests to use System.Text.Json…
reeshika-h Jun 2, 2026
979d93b
Merge branch 'enhc/beta' into enh/DX-7308-role-migration
reeshika-h Jun 2, 2026
9cf9907
refactor: update Role method signature and re-enable Role.cs for STJ …
reeshika-h Jun 2, 2026
ca9a54b
feat: Added the fix for Extention and role module
OMpawar-21 Jun 2, 2026
3acf880
feat: add PreviewToken and PreviewTokenModel classes with integration…
reeshika-h Jun 3, 2026
c1e3eed
Merge pull request #190 from contentstack/enh/DX-7308-role-migration
reeshika-h Jun 3, 2026
c9c011c
refactor: update PreviewTokenModel properties to use nullable strings
reeshika-h Jun 3, 2026
6342079
Merge branch 'enhc/beta' into enhc/DX-8641
OMpawar-21 Jun 4, 2026
3b84893
fix: the *comments in Stack.cs
OMpawar-21 Jun 4, 2026
ebec84d
fix: nullable operator fix
OMpawar-21 Jun 4, 2026
93aefe5
fix: warning issues resolved
OMpawar-21 Jun 4, 2026
827d2ed
Merge pull request #191 from contentstack/enhc/DX-8641
OMpawar-21 Jun 4, 2026
0c8f4ca
Merge pull request #192 from contentstack/enh/DX-8570-preview-token
OMpawar-21 Jun 5, 2026
1433950
feat: Added fix for Entry Variant and Variant group
OMpawar-21 Jun 6, 2026
282232c
Merge pull request #193 from contentstack/fix/beta-testcases-fix
OMpawar-21 Jun 8, 2026
316ce56
fix: made changes for update changelog.
OMpawar-21 Jun 9, 2026
b5b9b78
updated date
OMpawar-21 Jun 9, 2026
bdd5f0e
Merge pull request #194 from contentstack/fix/beta-changelog-update
OMpawar-21 Jun 9, 2026
816b480
feat: add multi-region endpoint resolution via Endpoint static class
OMpawar-21 Jun 11, 2026
f6f9843
Merge pull request #195 from contentstack/enhc/DX-7278
OMpawar-21 Jun 11, 2026
304c1bf
Fixed GH workflow
netrajpatel Jun 16, 2026
fdc7287
Merge pull request #196 from contentstack/fix/workflow
netrajpatel Jun 16, 2026
87f0aeb
Added testcases for asset images upload
sunil-lakshman Jun 18, 2026
74faabb
Merge pull request #197 from contentstack/enh/dx-8967
sunil-lakshman Jun 19, 2026
5f2934c
fix: replace refresh-region.cs with refresh-region.py; fix flaky bulk…
OMpawar-21 Jun 20, 2026
fa84f47
Update CHANGELOG.md
OMpawar-21 Jun 20, 2026
bc4f618
Update CHANGELOG.md
OMpawar-21 Jun 20, 2026
ccdf729
Delete requirements.txt
OMpawar-21 Jun 20, 2026
d02f165
Update CHANGELOG.md
OMpawar-21 Jun 20, 2026
5449bd8
Revert "Update CHANGELOG.md"
OMpawar-21 Jun 20, 2026
c5827e3
Merge pull request #198 from contentstack/fix/DX-9233
OMpawar-21 Jun 20, 2026
7296757
feat: add asset scanning tests for _asset_scan_status param and api_v…
OMpawar-21 Jun 26, 2026
938098c
fix: params namings
OMpawar-21 Jun 27, 2026
2f095ae
Merge pull request #199 from contentstack/enhc/DX-8753
reeshika-h Jul 3, 2026
a7b99d7
Merge pull request #204 from contentstack/main
reeshika-h Jul 9, 2026
1f96a46
fix: test cases for sanity pipeline
OMpawar-21 Jul 9, 2026
d59a4e3
Update .gitignore
OMpawar-21 Jul 9, 2026
2400f8b
Merge pull request #205 from contentstack/fix/sanity-pipeline-testCases
maheshmotkar-cs Jul 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/check-version-bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || true)
if [ -z "$LATEST_TAG" ]; then
echo "No existing tags found. Skipping semver vs tag check."
CHANGELOG_HEAD=$(sed -nE 's/^## \[v?([0-9]+\.[0-9]+\.[0-9]+)\].*/\1/p' CHANGELOG.md | head -1)
CHANGELOG_HEAD=$(sed -nE 's/^## \[v?([0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z][0-9A-Za-z.-]*)?)\].*/\1/p' CHANGELOG.md | head -1)
if [ -z "$CHANGELOG_HEAD" ]; then
echo "::error::Could not find a ## [vX.Y.Z] entry at the top of CHANGELOG.md."
exit 1
Expand All @@ -105,7 +105,7 @@ jobs:
exit 1
fi

CHANGELOG_HEAD=$(sed -nE 's/^## \[v?([0-9]+\.[0-9]+\.[0-9]+)\].*/\1/p' CHANGELOG.md | head -1)
CHANGELOG_HEAD=$(sed -nE 's/^## \[v?([0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z][0-9A-Za-z.-]*)?)\].*/\1/p' CHANGELOG.md | head -1)
if [ -z "$CHANGELOG_HEAD" ]; then
echo "::error::Could not find a ## [vX.Y.Z] entry at the top of CHANGELOG.md."
exit 1
Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/nuget-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,46 @@ on:
types: [created]

jobs:
publish-nuget:
publish-nuget:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4.2.2
- name: Setup .NET Core @ Latest
uses: actions/setup-dotnet@v4.3.0
with:
dotnet-version: 10.0.x
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY }}
- name: Build solution and generate NuGet package
run: |
dotnet pack -c Release -o out

- name: Push generated package to GitHub registry
- name: Push generated package to NuGet.org
run: |
cd out
dotnet nuget push "contentstack.management.csharp.*.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate --no-symbols --source https://api.nuget.org/v3/index.json

publish-git:
publish-git:
runs-on: windows-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4.2.2
- name: Setup .NET Core @ Latest
uses: actions/setup-dotnet@v4.3.0
with:
dotnet-version: 10.0.x
source-url: https://nuget.pkg.github.com/Contentstack/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build solution and generate NuGet package
run: |
dotnet pack -c Release -o out

- name: Push generated package to GitHub registry
- name: Push generated package to GitHub Packages
run: |
cd out
dotnet nuget push "contentstack.management.csharp.*.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate --no-symbols --source https://api.nuget.org/v3/index.json
dotnet nuget push "contentstack.management.csharp.*.nupkg" --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate --no-symbols --source https://nuget.pkg.github.com/Contentstack/index.json
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ packages/
*/appSettings.json
api_referece/*
.sonarqube/
*.html
*.cobertura.xml
integration-test-report_*.html
*.zip
.trx
.trx
*.html
43 changes: 41 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,46 @@
# Changelog


## [v0.10.0](https://github.com/contentstack/contentstack-management-dotnet/tree/v0.9.0)
## [v1.0.0-beta.2](https://github.com/contentstack/contentstack-management-dotnet/tree/v1.0.0-beta.2)(2026-06-22)

- **Chore**
- Replaced `Scripts/refresh-region.cs` with `Scripts/refresh-region.py` — prevents MSBuild from compiling the script as source code
- Added SSL fallback in `refresh-region.py` for macOS certificate verification failures
- Updated `contentstack.management.csharp.targets` and `contentstack.management.core.csproj` to package and deliver the `.py` script
- **Fix**
- Bulk operation tests: accept `401 Unauthorized` alongside `404/400` for invalid/expired job ID assertions
- Bulk operation tests: made workflow stage assignment non-fatal in `Test002` to prevent failures when workflow API is unavailable
- **Test**
- **Image format upload coverage**
- Added `Test100_Should_Upload_JPEG_Image_Asset` — uploads `london.jpg` via `image/jpeg` MIME type and verifies `Created` status and `content_type` in response
- Added `Test101_Should_Upload_JPEG_Extension_Image_Asset` — uploads `tokyo.jpeg` (`.jpeg` extension) and asserts `image/jpeg` content type
- Added `Test102_Should_Upload_AVIF_Image_Asset` — uploads `dubai.avif` via `image/avif` MIME type and accepts `image/avif` or `application/octet-stream` content type
- Added `Test103_Should_Upload_Multiple_Image_Formats_Sequentially` — uploads all three images in sequence and asserts `Created` on each
- Added `Test104_Should_Fetch_Uploaded_Image_Asset_Metadata` — creates a JPEG asset and fetches it back, asserting `uid`, `filename`, `content_type`, and `file_size` fields are present
- Added `Test105_Should_Update_Uploaded_Image_Asset` — creates a JPEG asset then replaces it with a different JPEG and verifies the `200 OK` update response
- Test image files (`london.jpg`, `tokyo.jpeg`, `dubai.avif`) live under `Contentstack.Management.Core.Tests/Mock/assets/`

## [v1.0.0-beta.1](https://github.com/contentstack/contentstack-management-dotnet/tree/v1.0.0-beta.1)(2026-06-15)
- **Feat**
- **Branch support**
- Added `Branch` model with `Create`, `CreateAsync`, `Fetch`, `FetchAsync`, `Delete`, `DeleteAsync`, and `Query` operations
- `Stack.Branch(uid?)` accessor follows the same pattern as other stack resources
- **Breaking Change**
- **Complete migration from Newtonsoft.Json to System.Text.Json**
- `Newtonsoft.Json` is no longer a dependency — remove it from your project once your own code no longer references it directly
- `client.SerializerSettings` (`JsonSerializerSettings`) replaced by `client.SerializerOptions` (`JsonSerializerOptions`)
- `response.OpenJObjectResponse()` removed — use `response.OpenJsonObjectResponse()` (`JsonObject`) or `response.OpenTResponse<T>()` instead
- `JObjectParameterValue` now accepts `System.Text.Json.Nodes.JsonNode` instead of `Newtonsoft.Json.Linq.JObject`
- All `[JsonProperty]` attributes replaced with `[JsonPropertyName]`; `[JsonObject(ItemNullValueHandling)]` removed in favour of `DefaultIgnoreCondition = WhenWritingNull` on `SerializerOptions`
- All modules fully migrated to System.Text.Json: AuditLog, Branch, BulkOperation, ContentType, DeliveryToken, Entry, EntryVariant, Environment, Extension, GlobalField, Label, Locale, ManagementToken, Organization, Release, Role, Stack, Taxonomy, Term, User, VariantGroup, Webhook, and Workflow
- OAuth auto token refresh wired into the request pipeline
- Upgraded target framework to .NET 10
- **New:** Multi-region endpoint resolution via `Endpoint.GetContentstackEndpoint(region, service)` — resolves Contentstack service URLs for all 7 supported regions (NA, EU, AU, Azure-NA, Azure-EU, GCP-NA, GCP-EU) and 18 service keys (contentManagement, contentDelivery, auth, graphqlDelivery, preview, images, assets, automate, launch, developerHub, brandKit, genAI, personalizeManagement, personalizeEdge, composableStudio, assetManagement, and more).
- **New:** `omitHttps` flag strips the `https://` scheme from returned URLs — pass directly to `ContentstackClientOptions.Host` (e.g. `new ContentstackClientOptions { Host = Endpoint.GetContentstackEndpoint("eu", "contentManagement", omitHttps: true) }`).
- **New:** Case-insensitive region alias support — `"us"`, `"NA"`, `"AWS-NA"`, `"azure_na"` all resolve correctly to the same region.
- **New:** `regions.json` registry auto-downloaded from `artifacts.contentstack.com` on first use and cached on disk — no setup required. The SDK self-heals if the file is missing.
- **New:** `Scripts/refresh-region.cs` bundled inside the NuGet package — automatically placed in your project's `Scripts/` folder on first `dotnet build`. Run `dotnet run Scripts/refresh-region.cs` anytime to pull the latest regions from CDN.

## [v0.10.0](https://github.com/contentstack/contentstack-management-dotnet/tree/v0.10.0)
- Feat
- **Enhanced Error Handling and Test Coverage (DX-5436)**
- Added comprehensive error handling across all models with enhanced `ContentstackErrorException`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>

<IsPackable>false</IsPackable>
<ReleaseVersion>$(Version)</ReleaseVersion>
Expand All @@ -24,8 +24,6 @@
<PackageReference Include="AutoFixture.AutoMoq" Version="4.18.1" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.3.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
</ItemGroup>

<ItemGroup>
Expand All @@ -52,4 +50,5 @@
<ItemGroup>
<ProjectReference Include="..\Contentstack.Management.Core\contentstack.management.core.csproj" />
</ItemGroup>

</Project>
14 changes: 6 additions & 8 deletions Contentstack.Management.Core.Tests/Contentstack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
using Contentstack.Management.Core.Tests.Model;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Text.Json;
using System.Text.Json.Nodes;

namespace Contentstack.Management.Core.Tests
{
Expand Down Expand Up @@ -242,17 +242,15 @@ public static ContentstackClient CreateAuthenticatedClient()
return client;
}

public static T serialize<T>(JsonSerializer serializer, string filePath)
public static T serialize<T>(JsonSerializerOptions options, string filePath)
{
string response = GetResourceText(filePath);
JObject jObject = JObject.Parse(response);
return jObject.ToObject<T>(serializer);
return JsonSerializer.Deserialize<T>(response, options);
}
public static T serializeArray<T>(JsonSerializer serializer, string filePath)
public static T serializeArray<T>(JsonSerializerOptions options, string filePath)
{
string response = GetResourceText(filePath);
JArray jObject = JArray.Parse(response);
return jObject.ToObject<T>(serializer);
return JsonSerializer.Deserialize<T>(response, options);
}

public static string GetResourceText(string resourceName)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Contentstack.Management.Core.Models;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Text.Json;
using System.Text.Json.Nodes;

namespace Contentstack.Management.Core.Tests.Helpers
{
Expand All @@ -9,15 +9,15 @@ namespace Contentstack.Management.Core.Tests.Helpers
/// </summary>
public static class ContentTypeFixtureLoader
{
public static ContentModelling LoadFromMock(JsonSerializer serializer, string embeddedFileName, string uidSuffix)
public static ContentModelling LoadFromMock(JsonSerializerOptions options, string embeddedFileName, string uidSuffix)
{
var text = Contentstack.GetResourceText(embeddedFileName);
var jo = JObject.Parse(text);
var baseUid = jo["uid"]?.Value<string>() ?? "ct";
var jo = JsonNode.Parse(text)!.AsObject();
var baseUid = jo["uid"]?.GetValue<string>() ?? "ct";
jo["uid"] = $"{baseUid}_{uidSuffix}";
var title = jo["title"]?.Value<string>() ?? "CT";
var title = jo["title"]?.GetValue<string>() ?? "CT";
jo["title"] = $"{title} {uidSuffix}";
return jo.ToObject<ContentModelling>(serializer);
return JsonSerializer.Deserialize<ContentModelling>(jo.ToJsonString(), options);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Newtonsoft.Json;
using System.Text.Json;

namespace Contentstack.Management.Core.Tests.Helpers
{
Expand Down Expand Up @@ -44,7 +44,7 @@ protected override async Task<HttpResponseMessage> SendAsync(
errors = _additionalFields
};

var jsonContent = JsonConvert.SerializeObject(errorResponse);
var jsonContent = JsonSerializer.Serialize(errorResponse);
var response = new HttpResponseMessage(_statusCode)
{
Content = new StringContent(jsonContent, Encoding.UTF8, "application/json"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using System.Text.Json;

namespace Contentstack.Management.Core.Tests.Helpers
{
Expand Down Expand Up @@ -64,7 +64,7 @@ private static void Emit(object data)
{
try
{
var json = JsonConvert.SerializeObject(data, Formatting.None);
var json = JsonSerializer.Serialize(data);
Console.Write(START_MARKER);
Console.Write(json);
Console.WriteLine(END_MARKER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using Contentstack.Management.Core.Tests.Helpers;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Contentstack.Management.Core.Queryable;
using Newtonsoft.Json.Linq;
using System.Text.Json;

namespace Contentstack.Management.Core.Tests.IntegrationTest
{
Expand Down Expand Up @@ -145,7 +145,7 @@ public void Test005_Should_Return_Loggedin_User()

ContentstackResponse response = client.GetUser();

var user = response.OpenJObjectResponse();
var user = response.OpenJsonObjectResponse();

AssertLogger.IsNotNull(user, "user");

Expand All @@ -169,11 +169,11 @@ public async System.Threading.Tasks.Task Test006_Should_Return_Loggedin_User_Asy

ContentstackResponse response = await client.GetUserAsync();

var user = response.OpenJObjectResponse();
var user = response.OpenJsonObjectResponse();

AssertLogger.IsNotNull(user, "user");
AssertLogger.IsNotNull(user["user"]["organizations"], "organizations");
AssertLogger.IsInstanceOfType(user["user"]["organizations"], typeof(JArray), "organizations");
AssertLogger.IsInstanceOfType(user["user"]["organizations"], typeof(System.Text.Json.Nodes.JsonArray), "organizations");
AssertLogger.IsNull(user["user"]["organizations"][0]["org_roles"], "org_roles");

}
Expand All @@ -199,11 +199,11 @@ public void Test007_Should_Return_Loggedin_User_With_Organizations_detail()

ContentstackResponse response = client.GetUser(collection);

var user = response.OpenJObjectResponse();
var user = response.OpenJsonObjectResponse();

AssertLogger.IsNotNull(user, "user");
AssertLogger.IsNotNull(user["user"]["organizations"], "organizations");
AssertLogger.IsInstanceOfType(user["user"]["organizations"], typeof(JArray), "organizations");
AssertLogger.IsInstanceOfType(user["user"]["organizations"], typeof(System.Text.Json.Nodes.JsonArray), "organizations");
AssertLogger.IsNotNull(user["user"]["organizations"][0]["org_roles"], "org_roles");
}
catch (Exception e)
Expand Down Expand Up @@ -1000,7 +1000,7 @@ public void Test056_Should_Handle_Malformed_JSON_Response_Sync()
{
AssertLogger.IsTrue(true, "ContentstackErrorException acceptable for malformed JSON");
}
catch (Newtonsoft.Json.JsonException)
catch (System.Text.Json.JsonException)
{
AssertLogger.IsTrue(true, "JsonException acceptable for malformed JSON");
}
Expand All @@ -1027,7 +1027,7 @@ public async System.Threading.Tasks.Task Test057_Should_Handle_Malformed_JSON_Re
{
AssertLogger.IsTrue(true, "ContentstackErrorException acceptable for malformed JSON");
}
catch (Newtonsoft.Json.JsonException)
catch (System.Text.Json.JsonException)
{
AssertLogger.IsTrue(true, "JsonException acceptable for malformed JSON");
}
Expand Down Expand Up @@ -1058,7 +1058,7 @@ public void Test058_Should_Handle_Empty_Response_Body_Sync()
{
AssertLogger.IsTrue(true, "ArgumentException acceptable for empty response");
}
catch (Newtonsoft.Json.JsonReaderException)
catch (System.Text.Json.JsonException)
{
AssertLogger.IsTrue(true, "JsonReaderException acceptable for empty response");
}
Expand Down Expand Up @@ -1089,7 +1089,7 @@ public async System.Threading.Tasks.Task Test059_Should_Handle_Empty_Response_Bo
{
AssertLogger.IsTrue(true, "ArgumentException acceptable for empty response");
}
catch (Newtonsoft.Json.JsonReaderException)
catch (System.Text.Json.JsonException)
{
AssertLogger.IsTrue(true, "JsonReaderException acceptable for empty response");
}
Expand Down Expand Up @@ -1141,7 +1141,7 @@ public void Test060_Should_Handle_Unexpected_Response_Structure_Sync()
{
AssertLogger.IsTrue(true, "KeyNotFoundException acceptable for unexpected structure");
}
catch (Newtonsoft.Json.JsonException)
catch (System.Text.Json.JsonException)
{
AssertLogger.IsTrue(true, "JsonException acceptable for unexpected structure");
}
Expand Down Expand Up @@ -1284,8 +1284,9 @@ public void Test069_Should_Handle_GetUser_With_Extremely_Large_Parameters_Sync()
catch (ContentstackErrorException errorException)
{
AssertLogger.IsTrue(errorException.StatusCode == HttpStatusCode.BadRequest ||
errorException.StatusCode == HttpStatusCode.RequestEntityTooLarge,
"Expected 400 or 413 for large parameters");
errorException.StatusCode == HttpStatusCode.RequestEntityTooLarge ||
errorException.StatusCode == HttpStatusCode.RequestUriTooLong,
"Expected 400, 413, or 414 for large parameters");
}
catch (Exception e)
{
Expand Down Expand Up @@ -1393,7 +1394,7 @@ public void Test073_Should_Handle_GetUser_Malformed_Response_Sync()
{
AssertLogger.IsTrue(true, "ContentstackErrorException acceptable for malformed response");
}
catch (Newtonsoft.Json.JsonException)
catch (System.Text.Json.JsonException)
{
AssertLogger.IsTrue(true, "JsonException acceptable for malformed response");
}
Expand Down Expand Up @@ -1513,7 +1514,7 @@ public void Test088_Should_Handle_TOTP_Token_Format_Variations_Sync()
{
client.Login(credentials, token);
}
catch (ArgumentException ex) when (token.Length != 6 || token.Any(c => !char.IsDigit(c)))
catch (ArgumentException) when (token.Length != 6 || token.Any(c => !char.IsDigit(c)))
{
AssertLogger.IsTrue(true, $"ArgumentException for invalid token format: '{token}'");
}
Expand Down Expand Up @@ -1856,7 +1857,7 @@ public async System.Threading.Tasks.Task Test100_Should_Validate_Complete_Error_
{
results.Add((scenario, false, "TaskCanceledException"));
}
catch (Newtonsoft.Json.JsonException)
catch (System.Text.Json.JsonException)
{
results.Add((scenario, false, "JsonException"));
}
Expand Down
Loading
Loading