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

Enum value names #1123

Closed
stuartbloom opened this issue May 24, 2017 · 7 comments
Closed

Enum value names #1123

stuartbloom opened this issue May 24, 2017 · 7 comments

Comments

@stuartbloom
Copy link

I have the following enum:

namespace WebApi.Logic.CustomPages.Dtos
{
    public enum CustomPageFieldType
    {
        Text = 1,
        Numeric,
        Date,
        Numeric_Function,
        Dropdown_List,
        Checkbox
    }
}

However, when a class includes this as a property it is shown as type (integer, optional) = ['1', '2', '3', '4', '5', '6']integerEnum:1, 2, 3, 4, 5, 6,, and when exported using NSwag as a Typescript enum it has the following definition:

export enum CustomPageFieldResponseDtoType {
    _1 = 1, 
    _2 = 2, 
    _3 = 3, 
    _4 = 4, 
    _5 = 5, 
    _6 = 6, 
}

How can i get it so that the enum is exported as:

export enum CustomPageFieldResponseDtoType {
    Text = 1, 
    Numeric = 2, 
    Date = 3, 
    Numeric_Function = 4, 
    Dropdown_List = 5, 
    Checkbox = 6, 
}

Thanks

@chrsmrtn-
Copy link

I too have this same issue

@webron
Copy link
Member

webron commented May 25, 2017

This is currently not supported by the spec, see #348. Tooling can try to use extensions to overcome it.

@webron webron closed this as completed May 25, 2017
@stuartbloom
Copy link
Author

@webron thanks for the info, but are there any examples?

@webron
Copy link
Member

webron commented May 25, 2017

Examples for what? It's not supported.

@stuartbloom
Copy link
Author

@webron I thought you said tooling and extensions can help.

@webron
Copy link
Member

webron commented May 26, 2017

I said people can try using them, I don't know if that would work. I do not have examples for it.

@aureole82
Copy link

This is currently not supported by the spec, see #348. Tooling can try to use extensions to overcome it.

I don't think that #348 matches exactly the question. Please reconsider your answer and take the first step. Otherwise Swashbuckle, NSwag and others will never be able to generate decent C# / Typescript / ... enums. We developers are quite desperate.

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

4 participants