Skip to content

Commit

Permalink
feat(csharp): Make JsonSerializerOptions more configurable (#5227)
Browse files Browse the repository at this point in the history
Provide partial method ConfigureJsonSerializerOptions to let SDK maintainers customize JsonSerializerOptions
  • Loading branch information
Swimburger authored Nov 20, 2024
1 parent cc8f9cd commit c81bb89
Show file tree
Hide file tree
Showing 145 changed files with 853 additions and 279 deletions.
4 changes: 4 additions & 0 deletions fern/pages/changelogs/csharp-sdk/2024-11-20.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## 1.9.10
**`(feat):`** Add partial `JsonOptions.ConfigureJsonSerializerOptions` method to allow SDK maintainers to configure the `JsonSerializerOptions` used by the SDK.


2 changes: 1 addition & 1 deletion generators/csharp/codegen/src/AsIs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const AsIsFiles = {
Headers: "Headers.Template.cs",
HeaderValue: "HeaderValue.Template.cs",
HttpMethodExtensions: "HttpMethodExtensions.cs",
JsonConfiguration: "JsonConfiguration.cs",
JsonConfiguration: "JsonConfiguration.Template.cs",
OneOfSerializer: "OneOfSerializer.cs",
Page: "Page.Template.cs",
Pager: "Pager.Template.cs",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,23 @@

namespace <%= namespace%>;

internal static class JsonOptions
internal static partial class JsonOptions
{
public static readonly JsonSerializerOptions JsonSerializerOptions;

static JsonOptions()
{
JsonSerializerOptions = new JsonSerializerOptions
var options = new JsonSerializerOptions
{
Converters = { new DateTimeSerializer(), new OneOfSerializer() },
WriteIndented = true,
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
};
ConfigureJsonSerializerOptions(options);
JsonSerializerOptions = options;
}

static partial void ConfigureJsonSerializerOptions(JsonSerializerOptions defaultOptions);
}

internal static class JsonUtils
Expand Down
7 changes: 7 additions & 0 deletions generators/csharp/sdk/versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
# The C# SDK now uses forward-compatible enums which are not compatible with the previously generated enums.
# Set `enable-forward-compatible-enums` to `false` in the configuration to generate the old enums.
# irVersion: 53
- version: 1.9.10
createdAt: "2024-11-20"
changelogEntry:
- type: feat
summary: |
Add partial `JsonOptions.ConfigureJsonSerializerOptions` method to allow SDK maintainers to configure the `JsonSerializerOptions` used by the SDK.
irVersion: 53
- version: 1.9.9
createdAt: "2024-11-19"
changelogEntry:
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c81bb89

Please sign in to comment.