🌿 ✨ [Scheduled] Upgrade Fern C# SDK Generator: (csharp-sdk
)
#8
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.
Upgrading from
1.7.0
to1.9.5
- Changelog1.9.5
feat:
Copy the csproj Version as the AssemblyVersion and FileVersion.1.9.4
feat:
Generate a ProjectName.Test.Custom.props file for you to configure any MSBuild properties for your test project.feat:
Only import ProjectName.Custom.props and ProjectName.Test.Custom.props if the file exists, so you can delete the file if you wish to.fix:
Do not re-import the .NET SDK inside of ProjectName.Custom.props.1.9.3
feat:
Generate a ProjectName.Custom.props file for you to configure any MSBuild properties for your project.fix:
Generate the license NuGet properties inside the .csproj file correctly.1.9.1
chore:
UpdateSystem.Text.Json
dependency from8.0.4
to8.0.5
because a security patch was released to resolve this vulnerability.1.9.0
feat:
Add support for calling HTTP endpoints and gRPC endoints within the same service.6 additional updates, see more
1.8.5
feat:
Add forward-compatible enums. Setexperimental-enable-forward-compatible-enums
totrue
in the configuration to generate forward-compatible enums.With forward-compatible enums you can create and parse an enum value that is not predefined.
This is a breaking change for the users of the generated SDK, but only users using switch-case statements are affected.
Value
property to get the string value of the enum. - For each value in the enum,Values
class with the string value of the enum.Here's a before and after for creating and parsing a resource with a predefined enum value and a custom enum value:
Before:
csharp var resource = client.CreateResource(new Resource { Id = "2", EnumProperty = MyEnum.Value2 } ); // The line below does not compile because the enum does not have a `Value3` value. // resource = client.CreateResource(new Resource { Id = "3", EnumProperty = MyEnum.Value3 } ); resource = client.GetResource("3"); switch(resource.EnumProperty) { case MyEnum.Value1: Console.WriteLine("Value1"); break; case MyEnum.Value2: Console.WriteLine("Value2"); break; default: // this will never be reached until the SDK is updated with the new enum value Console.WriteLine("Unknown"); break; } if(resource.EnumProperty == MyEnum.Value1) { Console.WriteLine("Value1"); } else if (resource.EnumProperty == MyEnum.Value2) { Console.WriteLine("Value2"); } else { // this will never be reached until the SDK is updated with the new enum value Console.WriteLine("Unknown"); }
No exception is thrown, but the output incorrectly shows
Value1
because .NET falls back to the first value in the enum.After: