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

Generated C# code contains "*" in enumerations #1916

Closed
onatbuyukakkus opened this issue Jan 24, 2019 · 0 comments
Closed

Generated C# code contains "*" in enumerations #1916

onatbuyukakkus opened this issue Jan 24, 2019 · 0 comments

Comments

@onatbuyukakkus
Copy link

JSON

"/entity({entity_id})":
  parameters: 
   - name: entity_id
     in: path
     required: true
     schema:
      type: string
      format: uuid
   - name: $select
     in: query
     schema:
      type: array
      items:
       type: string
       enum: ['*', 'id', 'name']
       default: '*'
     style: form
     explode: false

When "*" is an enum, generated C# client class has following

[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "9.13.13.0 (Newtonsoft.Json v11.0.0.0)")]
    public enum Anonymous
    {
        [System.Runtime.Serialization.EnumMember(Value = @"*")]
        * = 0,
    
        [System.Runtime.Serialization.EnumMember(Value = @"id")]
        Id = 1,
    
        [System.Runtime.Serialization.EnumMember(Value = @"name")]
        Name = 2,
    }

Since "*" is not a valid variable name in C#, compiler gives an error. Problem is probably in here.

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

1 participant