feat(csharp): add options to disable DateOnly and TimeOnly generation for System.Text.Json#2842
Open
findyoucef wants to merge 4 commits intoglideapps:masterfrom
Open
feat(csharp): add options to disable DateOnly and TimeOnly generation for System.Text.Json#2842findyoucef wants to merge 4 commits intoglideapps:masterfrom
findyoucef wants to merge 4 commits intoglideapps:masterfrom
Conversation
- Updated package.json dependencies for ajv and esbuild. - Introduced new boolean options `no-dateonly` and `no-timeonly` in CSharp language options to control the usage of DateOnly and TimeOnly types. - Refactored SystemTextJsonCSharpRenderer to utilize the new options, allowing for conditional registration of DateOnly and TimeOnly converters. - Added helper methods to determine whether to use DateOnly and TimeOnly based on the new options.
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.
Description
Adds two new C# renderer options to control whether
DateOnlyandTimeOnlytypes are emitted when generating System.Text.Json code. Also updates the renderer to conditionally register their converters and refreshesajvandesbuilddependencies.Related Issue
#2629
Motivation and Context
Projects targeting .NET Standard lack
DateOnlyandTimeOnly, causing compilation errors in generated code. This change adds--no-dateonlyand--no-timeonlyoptions so users can disable these types for better cross-platform compatibility.Previous Behaviour / Output
Generated code always included:
Which fails on .NET Standard.
New Behaviour / Output
With flags:
Output now omits
DateOnly/TimeOnlyand related converters:How Has This Been Tested?
DateOnly/TimeOnlytypes.Summary
Adds
no-dateonlyandno-timeonlyC# options for System.Text.Json codegen.Impact
Allows generating C# code compatible with .NET Standard by disabling unsupported
DateOnly/TimeOnlytypes.