Skip to content

Conversation

cnblogs-dudu
Copy link
Contributor

@cnblogs-dudu cnblogs-dudu commented Oct 7, 2025

Avoid Chinese characters being encoded

@ikesnowy
Copy link
Contributor

ikesnowy commented Oct 7, 2025

I revert all your changes under /src and the test you added can still be passed, please provide a valid test.

@cnblogs-dudu cnblogs-dudu marked this pull request as draft October 7, 2025 09:22
@cnblogs-dudu cnblogs-dudu force-pushed the stop-encoding-chinese-chars branch 2 times, most recently from ebcb422 to f084143 Compare October 7, 2025 13:50
@cnblogs-dudu cnblogs-dudu marked this pull request as ready for review October 7, 2025 14:18
@cnblogs-dudu cnblogs-dudu force-pushed the stop-encoding-chinese-chars branch from f084143 to e554b8d Compare October 7, 2025 14:19
@cnblogs-dudu cnblogs-dudu requested a review from ikesnowy October 7, 2025 14:21
@ikesnowy
Copy link
Contributor

ikesnowy commented Oct 7, 2025

Make the DefaultJsonSerializerOptions nullable seems reasonable and still remain configurability.

public JsonSerializerOptions? DefaultJsonSerializerOptions { get; set; }

Some old application may use PascalCase for JSON serialization and that breaks communication between new and old apps that using the Architecture.

Making serialization option configurable makes it possible to fix on the old application side without changing the global JSON serialization options.

I could make the change if that's okay with you.

@cnblogs-dudu cnblogs-dudu marked this pull request as draft October 7, 2025 14:30
@cnblogs-dudu cnblogs-dudu force-pushed the stop-encoding-chinese-chars branch from e554b8d to b3de9bd Compare October 7, 2025 15:01
@cnblogs-dudu cnblogs-dudu changed the title refactor: use built-in json options in Minimal APIs refactor: reuse default SerializerOptions in Minimal APIs Oct 7, 2025
@cnblogs-dudu cnblogs-dudu marked this pull request as ready for review October 7, 2025 15:04
@cnblogs-dudu
Copy link
Contributor Author

It turned out there was a really simple approach.

public JsonSerializerOptions DefaultJsonSerializerOptions { get; set; } = new JsonOptions().SerializerOptions;

@ikesnowy ikesnowy added this pull request to the merge queue Oct 7, 2025
Merged via the queue into main with commit 3c217d1 Oct 7, 2025
1 check passed
@ikesnowy ikesnowy deleted the stop-encoding-chinese-chars branch October 7, 2025 15:16
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.

2 participants