google / google/gnostic

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

Open
#407 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
2.3k
Forks
279
PR merge metrics
No merged PRs in 30d

Description

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

## proto file

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

message Condition {
Trinary attached = 1;
}
```

## expected output

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

## actual output

```yaml
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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.