FusionAuth / fusionauth-client-builder

The FusionAuth client library builder
https://fusionauth.io/
Apache License 2.0
6 stars 24 forks source link

Fix duplicate enum values in LambdaType #5

Closed varun7387 closed 4 years ago

varun7387 commented 4 years ago

Changed the enum values to be distinct. Having duplicates causes deserialization to fail on C#.

robotdan commented 4 years ago

Thank you for taking the time to submit a PR!

The code is correct, this is generated from the Java domain, if we change these values it will change the functions we build in our Lambdas.

https://github.com/FusionAuth/fusionauth-java-client/blob/master/src/main/java/io/fusionauth/domain/LambdaType.java

We have run into issues like this in the past , in this case the enum constructor values are really only used in FusionAuth and are not necessary in C#.

Perhaps this enum should be translated into C# as

public enum LambdaType {
            JWTPopulate, 
            OpenIDReconcile, 
            SAMLv2Reconcile, 
            SAMLv2Populate
  }

https://github.com/FusionAuth/fusionauth-netcore-client/blob/master/fusionauth-netcore-client/domain/io/fusionauth/domain/LambdaType.cs

@tyduptyler13 Is this just a change to the template to check for this enum by name and translate it differently?

tyduptyler13 commented 4 years ago

This change was to fix other enums that used string values instead of the enum name in the json. It appears I might have to add this class to the explicitly ignored enum types so that it doesn't add those annotations.

A good example of this is Algorithm

I will review the enums to see if any others might be accidentally doing this or maybe I can find a better rule to decide when to use these aliases.

tyduptyler13 commented 4 years ago

Thank you for your pull request. It was a good catch. I fixed this globally in our client builder so it should roll out to all of our client libraries that support domain.