Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add yaml format #2470

Merged
merged 14 commits into from
Nov 17, 2023
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@

## [Unreleased]

- No changes yet.
- Add support for `yaml` format. All commands that take image inputs, output images,
or convert between message formats, now take `yaml` as a format, in addition to
the existing `binpb` and `txtpb` formats. Some examples:
- `buf build -o image.yaml`
- `buf ls-files image.yaml`
- `buf convert --type foo.Bar --from input.binpb --to output.yaml`
- The `yaml` and `json` formats now accept two new options: `use_proto_names` and
`use_enum_numbers`. This affects output serialization. Some examples:
- `buf convert --type foo.Bar --from input.binpb --to output.yaml#use_proto_names=true`
- `buf convert --type foo.Bar --from input.binpb --to -#format=yaml,use_enum_numbers=true`

## [v1.28.1] - 2023-11-15

Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ require (
connectrpc.com/otelconnect v0.6.0
github.com/bufbuild/protocompile v0.6.1-0.20231108163138-146b831231f7
github.com/bufbuild/protovalidate-go v0.4.1
github.com/bufbuild/protoyaml-go v0.1.6
github.com/docker/docker v24.0.7+incompatible
github.com/go-chi/chi/v5 v5.0.10
github.com/gofrs/flock v0.8.1
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ github.com/bufbuild/protocompile v0.6.1-0.20231108163138-146b831231f7 h1:1pUks8V
github.com/bufbuild/protocompile v0.6.1-0.20231108163138-146b831231f7/go.mod h1:9N39DyRmxAF5+5AjqXQKV6hyWDI0EeoX4TRMix2ZnPE=
github.com/bufbuild/protovalidate-go v0.4.1 h1:ye/8S72WbEklCeltPkSEeT8Eu1A7P/gmMsmapkwqTFk=
github.com/bufbuild/protovalidate-go v0.4.1/go.mod h1:+p5FXfOjSEgLz5WBDTOMPMdQPXqALEERbJZU7huDCtA=
github.com/bufbuild/protoyaml-go v0.1.6 h1:wcdVCJOepw2Xd1KC53RuXoXkk4bc25gbFceFKN8QaO0=
github.com/bufbuild/protoyaml-go v0.1.6/go.mod h1:zrn7hI6KzmuW6kb8E437j3NAI2jY60eImQgxTInvcT8=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
Expand Down
16 changes: 11 additions & 5 deletions private/buf/bufcli/bufcli.go
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ func NewWireImageReader(
) bufwire.ImageReader {
return bufwire.NewImageReader(
logger,
newFetchImageReader(logger, storageosProvider, runner),
newFetchMessageReader(logger, storageosProvider, runner),
)
}

Expand All @@ -506,9 +506,12 @@ func NewWireImageWriter(
// NewWireProtoEncodingReader returns a new ProtoEncodingReader.
func NewWireProtoEncodingReader(
logger *zap.Logger,
storageosProvider storageos.Provider,
runner command.Runner,
) bufwire.ProtoEncodingReader {
return bufwire.NewProtoEncodingReader(
logger,
newFetchMessageReader(logger, storageosProvider, runner),
)
}

Expand All @@ -518,6 +521,9 @@ func NewWireProtoEncodingWriter(
) bufwire.ProtoEncodingWriter {
return bufwire.NewProtoEncodingWriter(
logger,
buffetch.NewWriter(
logger,
),
)
}

Expand Down Expand Up @@ -1010,14 +1016,14 @@ func newFetchSourceReader(
)
}

// newFetchImageReader creates a new buffetch.ImageReader with the default HTTP client
// newFetchMessageReader creates a new buffetch.MessageReader with the default HTTP client
// and git cloner.
func newFetchImageReader(
func newFetchMessageReader(
logger *zap.Logger,
storageosProvider storageos.Provider,
runner command.Runner,
) buffetch.ImageReader {
return buffetch.NewImageReader(
) buffetch.MessageReader {
return buffetch.NewMessageReader(
logger,
storageosProvider,
defaultHTTPClient,
Expand Down
138 changes: 0 additions & 138 deletions private/buf/bufconvert/bufconvert.go

This file was deleted.

40 changes: 0 additions & 40 deletions private/buf/bufconvert/message_encoding_ref.go

This file was deleted.

19 changes: 0 additions & 19 deletions private/buf/bufconvert/usage.gen.go

This file was deleted.

Loading