Skip to content

protoc-gen-openapi: Enum types that use stringified boolean values like "TRUE" are treated as the real boolean values #407

Description

@zaakn

env

  • protoc-gen-openapi: v0.6.8
  • protoc flags: --openapi_opt naming=proto,enum_type=string

proto file

enum Trinary {
	NULL = 0;
	TRUE = 1;
	FALSE = 2;
}

message Condition {
	Trinary attached = 1;
}

expected output

Condition:
    type: object
    properties:
        attached:
            enum:
                - 'NULL'
                - 'TRUE'
                - 'FALSE'
            type: string
            format: enum

actual output

Condition:
    type: object
    properties:
        attached:
            enum:
                - NULL
                - TRUE
                - FALSE
            type: string
            format: enum

I know it's better not to use reserved words, so this is just for usage feedback.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions