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

[TypeScript] StringEnumConverter with CamelCaseText generate PascalCase enums #1387

Closed
YZahringer opened this issue Jun 15, 2018 · 3 comments

Comments

@YZahringer
Copy link

When ASP.NET Core is configured with CamelCaseText StringEnumConverter, enums in TypeScript should be generated in CamelCase?

services.AddMvc().AddJsonOptions(options =>
{
    options.SerializerSettings.Converters.Add(new StringEnumConverter {CamelCaseText = true});
});
@RicoSuter
Copy link
Owner

Can you also show a sample enum, the actual and expected output?

@YZahringer
Copy link
Author

Actual API enum:

public enum MyEnum
{
    Value1,
    Value2
}

Actual TypeScript output:

export enum MyEnum {
  Value1 = "Value1", 
  Value2 = "Value2"
}

Expected TypeScript output (camelCase string):

export enum MyEnum {
  Value1 = "value1", 
  Value2 = "value2"
}

@RicoSuter
Copy link
Owner

TODO: Use SerializerSettings instead of ContractResolver in NSwag

RicoSuter added a commit to RicoSuter/NJsonSchema that referenced this issue Jun 18, 2018
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

No branches or pull requests

2 participants