Reproduce
Minimal repro structure

- Create
foo.proto:
syntax = "proto3";
package foo;
option go_package = 'example.com/example/foo';
service FooService {
rpc FooBar(FooRequest) returns (FooResponse);
}
message FooRequest {
}
message FooResponse {
}
- Add
api_openapi.yaml:
openapi:
document:
components:
security_schemes:
MyJwtBearer:
type: http
name: Authorization
in: header
scheme: bearer
bearer_format: JWT
services:
- selector: 'foo.FooService'
methods:
FooBar:
security:
- name: MyJwtBearer
scopes: [ ] # core setting
gateway:
endpoints:
- selector: 'foo.FooService.FooBar'
post: '/foo'
body: '*'
- Add
buf.gen.yaml:
version: v2
plugins:
- local: ../protoc-gen-openapiv3 # or remote to buf.build
out: ../gen
opt:
- openapi_config=api_openapi.yaml
- gateway_config=api_openapi.yaml
- output_format=json # core setting
- Run
buf generate
- Change
output_format to json
- Run
buf generate again
Actual behavior
Generated files
YAML
paths:
/foo:
post:
...
security:
- MyJwtBearer: []
JSON
"paths": {
"/foo": {
"post": {
....
"security": [
{
"MyJwtBearer": null
}
]
}
If we take a look into gemerated apidocs we will see that:
- yaml-specification has valid scope (
[]) for MyJwtBearer in /foo endpoint
- json-specification has
null scope for MyJwtBearer in /foo endpoint
If we check them out in Swagger Editor we will see, that json spec (with null scope) is invalid and editor misses auth for the endpoint.
Broken auth img

Expected behavior
Both yaml and json specs (output formats) will have the same identical scope value (empty array [])
Reproduce
Minimal repro structure
foo.proto:api_openapi.yaml:buf.gen.yaml:buf generateoutput_formattojsonbuf generateagainActual behavior
Generated files
YAML
JSON
If we take a look into gemerated apidocs we will see that:
[]) forMyJwtBearerin/fooendpointnullscope forMyJwtBearerin/fooendpointIf we check them out in Swagger Editor we will see, that json spec (with null scope) is invalid and editor misses auth for the endpoint.
Broken auth img
Expected behavior
Both
yamlandjsonspecs (output formats) will have the same identical scope value (empty array[])