Skip to content

buf source edit deprecate#

Deprecate Protobuf types

Usage#

$ buf source edit deprecate <source> [flags]

Description#

Deprecate Protobuf types by adding the 'deprecated = true' option.

The --prefix flag is required and specifies the fully-qualified name prefix of the types to deprecate. All types whose fully-qualified name starts with this prefix will have the 'deprecated = true' option added. For fields and enum values, only exact matches are deprecated.

Returns an error if no types match the specified prefixes. If matching types are already deprecated, no changes are made and the command succeeds.

By default, the source is the current directory and files are formatted and rewritten in-place.

Examples:

Deprecate all types under a package prefix:

$ buf source edit deprecate --prefix foo.bar

Deprecate a specific message and all nested types:

$ buf source edit deprecate --prefix foo.bar.MyMessage

Deprecate a specific field:

$ buf source edit deprecate --prefix foo.bar.MyMessage.my_field

Multiple --prefix flags can be specified:

$ buf source edit deprecate --prefix foo.bar --prefix baz.qux

Display a diff of the changes instead of rewriting files:

$ buf source edit deprecate --prefix foo.bar -d

Flags#

--config string#

The buf.yaml file or data to use for configuration

-d, --diff#

Display diffs instead of rewriting files

Do not follow symlinks when reading sources or configuration from the local filesystem By default, symlinks are followed in this CLI, but never followed on the Buf Schema Registry

--error-format string#

The format for build errors printed to stderr. Must be one of [text,json,msvs,junit,github-actions,gitlab-code-quality]

--exclude-path strings#

Exclude specific files or directories, e.g. "proto/a/a.proto", "proto/a" If specified multiple times, the union is taken

-h, --help#

help for deprecate

--path strings#

Limit to specific files or directories, e.g. "proto/a/a.proto", "proto/a" If specified multiple times, the union is taken

--prefix strings#

Required. The fully-qualified name prefix of types to deprecate. May be specified multiple times.

Flags inherited from parent commands#

--debug#

Turn on debug logging

--log-format string#

The log format [text,color,json]

--timeout duration#

The duration until timing out, setting it to 0 means no timeout

Parent Command#