Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌿 ✨ [Scheduled] Upgrade Fern C# SDK Generator: (csharp-sdk) #8

Merged
merged 1 commit into from
Nov 13, 2024

Conversation

fern-api[bot]
Copy link
Contributor

@fern-api fern-api bot commented Oct 21, 2024

Upgrading from 1.7.0 to 1.9.5 - Changelog

    1.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: Update System.Text.Json dependency from 8.0.4 to 8.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. Set experimental-enable-forward-compatible-enums to true in the configuration to generate forward-compatible enums.
    With forward-compatible enums you can create and parse an enum value that is not predefined.

    • Forward compatible enums are not compatible with the previously generated native enums.
      This is a breaking change for the users of the generated SDK, but only users using switch-case statements are affected.
    • Use the Value property to get the string value of the enum. - For each value in the enum,
      • a public static property is generated, which is an instance of the enum class,
      • a public static property is generated within the nested 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:

        case MyEnum.Values.Value1:
            Console.WriteLine("Value1");
            break;
        case MyEnum.Values.Value2:
            Console.WriteLine("Value2");
            break;
        default:
            Console.WriteLine(resource.EnumProperty.Value);
            break;
    } if(resource.EnumProperty == MyEnum.Value1) {
        Console.WriteLine("Value1");
    } else if (resource.EnumProperty == MyEnum.Value2) {
        Console.WriteLine("Value2");
    } else {
        Console.WriteLine(resource.EnumProperty.Value);
    } ```
    The output correctly shows `Value3`.
    </li>
    	
    <strong><code>1.8.4</code></strong>
    <li>
    
    <code>fix:</code> Make sure summary and code examples in XML code comments are XML encoded.
    </li>
    	
    <strong><code>1.8.3</code></strong>
    <li>
    
    <code>fix:</code> Update generated .gitignore files to not ignore C# files inside of folders named Logs and Releases.
    </li>
    	
    <strong><code>1.8.2</code></strong>
    <li>
    
    <code>fix:</code> Fixes a bug where the ClientOptions would not compile due to incorrect Clone method generation.
    </li>
    	
    <strong><code>1.8.1</code></strong>
    <li>
    
    <code>fix:</code> Fixes a bug where the `OauthTokenProvider.cs` was incorrectly referencing
    the endpoint method, causing code to fail to compile.
    
    </li>
    	
    <strong><code>1.8.0</code></strong>
    <li>
    
    <code>feat:</code> Adds support for Client Credentials OAuth with token refresh.
    
    Now you can instantiate your SDK by passing in clientId and clientSecret,
    and let fern handle retrieving and refreshing the token.
    
    ```cs
    var client = new ImdbClient("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET");
    await client.doThing();

Copy link

@fern-api fern-api bot force-pushed the fern/update/fern-csharp-sdk@api/csharp-sdk branch 2 times, most recently from b54bdd3 to 489dd9f Compare November 4, 2024 00:07
Copy link

github-actions bot commented Nov 4, 2024

@fern-api fern-api bot force-pushed the fern/update/fern-csharp-sdk@api/csharp-sdk branch from 489dd9f to 30372c9 Compare November 11, 2024 00:06
Copy link

@nikhilro nikhilro merged commit 8098172 into main Nov 13, 2024
4 checks passed
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.

1 participant