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

Flag enums #2788

Open
orihomie opened this issue Apr 10, 2020 · 2 comments
Open

Flag enums #2788

orihomie opened this issue Apr 10, 2020 · 2 comments

Comments

@orihomie
Copy link

Enums marked as [Flags], like this

	[Flags]
	public enum CarDocumentType: long
	{
		/// <summary>
		/// ПТС
		/// </summary>
		[Alias("ПТС")]
		Pts = 1,

		/// <summary>
		/// СТС
		/// </summary>
		[Alias("СТС")]
		Sts = 2,

		/// <summary>
		/// еПТС
		/// </summary>
		[Alias("еПТС")]
		EPts = 4
	}

when generated by swagger spec become this:

    [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.28.0 (Newtonsoft.Json v9.0.0.0)")]
    public enum CarDocumentInfoDocumentType
    {
        [System.Runtime.Serialization.EnumMember(Value = @"Pts")]
        Pts = 0,
    
        [System.Runtime.Serialization.EnumMember(Value = @"Sts")]
        Sts = 1,
    
        [System.Runtime.Serialization.EnumMember(Value = @"EPts")]
        EPts = 2,
    
    }

And when I'm tryin to convert enum with value 2, which is Sts, I get EPts, so that seems as a bug

@RicoSuter
Copy link
Owner

Ref RicoSuter/NJsonSchema#719

@RicoSuter
Copy link
Owner

OpenAPI does not support flag enums.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants