Usage of /usr/bin/protoc-gen-openapiv2:
-allow_delete_body
unless set, HTTP DELETE methods may not have a body
-allow_merge
if set, generation one OpenAPI file out of multiple protos
-allow_patch_feature
whether to hide update_mask fields in PATCH requests from the generated swagger file. (default true)
-allow_repeated_fields_in_body body
allows to use repeated field in body and `response_body` field of `google.api.http` annotation option. DEPRECATED: the value is ignored and always behaves as `true`. (default true)
-disable_default_errors
if set, disables generation of default errors. This is useful if you have defined custom error handling
-disable_default_responses
if set, disables generation of default responses. Useful if you have to support custom response codes that are not 200.
-disable_service_tags
if set, disables generation of service tags. This is useful if you do not want to expose the names of your backend grpc services.
-enable_field_deprecation
whether to process proto field's deprecated option.
-enable_rpc_deprecation
whether to process grpc method's deprecated option.
-enums_as_ints
whether to render enum values as integers, as opposed to string values
-expand_slashed_path_patterns
if set, expands path parameters with URI sub-paths into the URI. For example, "/v1/{name=projects/*}/resource" becomes "/v1/projects/{project}/resource".
-file string
where to load data from (default "-")
-fqn_for_openapi_name openapi_naming_strategy=fqn
if set, the object's OpenAPI names will use the fully qualified names from the proto definition (ie my.package.MyMessage.MyInnerMessage). DEPRECATED: prefer openapi_naming_strategy=fqn
-generate_unbound_methods
generate swagger metadata even for RPC methods that have no HttpRule annotation
-generate_x_go_type
if set, generates x-go-type extension using the go_package option from proto files
-go_template_args use_go_templates
provide a custom value that can override a key in the Go template. Requires the use_go_templates option to be set
-grpc_api_configuration string
path to file which describes the gRPC API Configuration in YAML format
-ignore_comments
if set, all protofile comments are excluded from output
-ignore_go_package_option
if set, tolerates proto files that don't declare a go_package option by synthesizing a placeholder import path instead of erroring. protoc-gen-openapiv2 never emits Go source, so this is normally safe; the one exception is when generate_x_go_type is also enabled, in which case the synthesized placeholder (not a real Go import path) will appear in the generated x-go-type extension for files that used this fallback.
-import_prefix string
prefix to be added to go package paths for imported proto files
-include_package_in_tags Tags
if unset, the gRPC service name is added to the Tags field of each operation. If set and the `package` directive is shown in the proto file, the package name will be prepended to the service name
-json_names_for_fields
if disabled, the original proto name will be used for generating OpenAPI definitions (default true)
-logtostderr
Legacy glog compatibility. This flag is a no-op, you can safely remove it
-merge_file_name string
target OpenAPI file name prefix after merge (default "apidocs")
-omit_array_item_type_when_ref_sibling
if set, will omit 'type: object' in array items when $ref is present to avoid strict no-$ref-siblings rule violations.
-omit_enum_default_value
if set, omit default enum value
-openapi_configuration string
path to file which describes the OpenAPI Configuration in YAML format
-openapi_naming_strategy legacy
use the given OpenAPI naming strategy. Allowed values are legacy, `fqn`, `simple`, `package`. If unset, either `legacy` or `fqn` are selected, depending on the value of the `fqn_for_openapi_name` flag
-output_format json
output content format. Allowed values are: json, `yaml` (default "json")
-preserve_rpc_order
if true, will ensure the order of paths emitted in openapi swagger files mirror the order of RPC methods found in proto files. If false, emitted paths will be ordered alphabetically.
-proto3_optional_nullable
whether Proto3 Optional fields should be marked as x-nullable
-recursive-depth int
maximum recursion count allowed for a field type (default 1000)
-remove_internal_comments (--
if set, removes all substrings in comments that start with (-- and end with `--)` as specified in https://google.aip.dev/192#internal-comments
-repeated_path_param_separator csv
configures how repeated fields should be split. Allowed values are csv, `pipes`, `ssv` and `tsv` (default "csv")
-simple_operation_ids
whether to remove the service prefix in the operationID generation. Can introduce duplicate operationIDs, use with caution.
-use_allof_for_refs
if set, will use allOf as container for $ref to preserve same-level properties.
-use_go_templates
if set, you can use Go templates in protofile comments
-use_proto3_field_semantics
if set, uses proto3 field semantics for the OpenAPI schema. This means that fields are required by default.
-version
print the current version
-visibility_restriction_selectors google.api.VisibilityRule
list of google.api.VisibilityRule visibility labels to include in the generated output when a visibility annotation is defined. Repeat this option to supply multiple values. Elements without visibility annotations are unaffected by this setting.
Options (40)
| Option | Description | Source |
|---|---|---|
-allow_delete_body | unless set, HTTP DELETE methods may not have a body | help |
-allow_merge | if set, generation one OpenAPI file out of multiple protos | help |
-allow_patch_feature | whether to hide update_mask fields in PATCH requests from the generated swagger file. | help |
-allow_repeated_fields_in_body body | allows to use repeated field in body and `response_body` field of `google.api.http` annotation option. | help |
-disable_default_errors | if set, disables generation of default errors. | help |
-disable_default_responses | if set, disables generation of default responses. | help |
-disable_service_tags | if set, disables generation of service tags. | help |
-enable_field_deprecation | whether to process proto field's deprecated option. | help |
-enable_rpc_deprecation | whether to process grpc method's deprecated option. | help |
-enums_as_ints | whether to render enum values as integers, as opposed to string values | help |
-expand_slashed_path_patterns | if set, expands path parameters with URI sub-paths into the URI. | help |
-file string | where to load data from (default "-") | help |
-fqn_for_openapi_name openapi_naming_strategy=fqn | if set, the object's OpenAPI names will use the fully qualified names from the proto definition (ie my.package.MyMessage.MyInnerMessage). | help |
-generate_unbound_methods | generate swagger metadata even for RPC methods that have no HttpRule annotation | help |
-generate_x_go_type | if set, generates x-go-type extension using the go_package option from proto files | help |
-go_template_args use_go_templates | provide a custom value that can override a key in the Go template. | help |
-grpc_api_configuration string | path to file which describes the gRPC API Configuration in YAML format | help |
-ignore_comments | if set, all protofile comments are excluded from output | help |
-ignore_go_package_option | if set, tolerates proto files that don't declare a go_package option by synthesizing a placeholder import path instead of erroring. | help |
-import_prefix string | prefix to be added to go package paths for imported proto files | help |
-include_package_in_tags Tags | if unset, the gRPC service name is added to the Tags field of each operation. | help |
-json_names_for_fields | if disabled, the original proto name will be used for generating OpenAPI definitions (default true) | help |
-logtostderr | Legacy glog compatibility. | help |
-merge_file_name string | target OpenAPI file name prefix after merge (default "apidocs") | help |
-omit_array_item_type_when_ref_sibling | if set, will omit 'type: object' in array items when $ref is present to avoid strict no-$ref-siblings rule violations. | help |
-omit_enum_default_value | if set, omit default enum value | help |
-openapi_configuration string | path to file which describes the OpenAPI Configuration in YAML format | help |
-openapi_naming_strategy legacy | use the given OpenAPI naming strategy. | help |
-output_format json | output content format. | help |
-preserve_rpc_order | if true, will ensure the order of paths emitted in openapi swagger files mirror the order of RPC methods found in proto files. | help |
-proto3_optional_nullable | whether Proto3 Optional fields should be marked as x-nullable | help |
-recursive-depth int | maximum recursion count allowed for a field type (default 1000) | help |
-remove_internal_comments (-- | if set, removes all substrings in comments that start with (-- and end with `--)` as specified in https://google.aip.dev/192#internal-comments | help |
-repeated_path_param_separator csv | configures how repeated fields should be split. | help |
-simple_operation_ids | whether to remove the service prefix in the operationID generation. | help |
-use_allof_for_refs | if set, will use allOf as container for $ref to preserve same-level properties. | help |
-use_go_templates | if set, you can use Go templates in protofile comments | help |
-use_proto3_field_semantics | if set, uses proto3 field semantics for the OpenAPI schema. | help |
-version | print the current version | help |
-visibility_restriction_selectors google.api.VisibilityRule | list of google.api.VisibilityRule visibility labels to include in the generated output when a visibility annotation is defined. | help |