You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -176,6 +176,7 @@ protoc-gen-connect-openapi also has support for the [OpenAPI v3 annotations](htt
176
176
| path | `{filepath}` | Output filepath, defaults to per-proto file output if not given. When using [buf](https://github.com/bufbuild/buf), generating multiple files to the same path requires additional configuration to avoid overwriting files. See [#159](https://github.com/sudorandom/protoc-gen-connect-openapi/issues/159). |
177
177
| path-prefix | `{path}` | Prefixes the given string to the beginning of each HTTP path. |
178
178
| features | `{feature1};{feature2};[...]` | Semicolon-separated list of features to enable. Options: `connectrpc`, `google.api.http`, `twirp`, `gnostic`, `protovalidate`; Default: `connectrpc;google.api.http;gnostic;protovalidate`. If this option is used, only the specified features will be enabled. |
179
+
| allowed-visibilities | `{visibility1};{visibility2};[...]` | Semicolon-separated list of visibility labels to include. If an element (service, method, message, enum, enum value, or field) has a `google.api.visibility` rule, it will only be included in the generated OpenAPI specification if its visibility label is in this list. If this option is omitted, all elements are included regardless of their visibility. |
179
180
| proto | - | Generate requests/responses with the protobuf content type |
180
181
| services | `{service_name}` | Specifies which services to include in the generated OpenAPI specification. If omitted, all services are included. The service name must be fully qualified (e.g., "package.name.ServiceName"). Wildcards (`*` and `**`) are supported; `*` matches a single package segment, while `**` matches multiple. This option can be provided multiple times to include multiple services. |
181
182
| short-operation-ids | - | Set the operationId to shortServiceName + "_" + method short name instead of the full method name. |
opts.Logger.Debug("Filtering service due to visibility", slog.String("service", string(service.FullName())), slog.Any("restriction_selectors", opts.AllowedVisibilities))
Copy file name to clipboardExpand all lines: internal/converter/options/options.go
+8Lines changed: 8 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -73,6 +73,8 @@ type Options struct {
73
73
DisableDefaultResponsebool
74
74
// EnabledFeatures is a map of enabled features.
75
75
EnabledFeaturesmap[Feature]bool
76
+
// AllowedVisibilities is a map of visibility strings to include. If an element has a `google.api.visibility` rule with a `restriction` that is not in this map, it will be excluded.
opts.Logger.Debug("Filtering method due to visibility", slog.String("method", string(method.FullName())), slog.Any("restriction_selectors", opts.AllowedVisibilities))
31
+
continue
32
+
}
33
+
26
34
// No matter what, we add the schemas for the method input/output
opts.Logger.Debug("Filtering message due to visibility", slog.String("message", string(md.FullName())), slog.Any("restriction_selectors", opts.AllowedVisibilities))
25
+
return
26
+
}
22
27
if_, ok:=doc.Components.Schemas.Get(string(md.FullName())); ok {
opts.Logger.Debug("Filtering enum due to visibility", slog.String("enum", string(ed.FullName())), slog.Any("restriction_selectors", opts.AllowedVisibilities))
70
+
return
71
+
}
63
72
if_, ok:=doc.Components.Schemas.Get(string(ed.FullName())); ok {
opts.Logger.Debug("Filtering enum value due to visibility", slog.String("enum_value", string(value.FullName())), slog.Any("restriction_selectors", opts.AllowedVisibilities))
opts.Logger.Debug("Filtering field due to visibility", slog.String("field", string(field.FullName())), slog.Any("restriction_selectors", opts.AllowedVisibilities))
0 commit comments