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

cue: proto support #5

Open
cueckoo opened this issue Jul 3, 2021 · 5 comments
Open

cue: proto support #5

cueckoo opened this issue Jul 3, 2021 · 5 comments
Labels

Comments

@cueckoo
Copy link
Collaborator

cueckoo commented Jul 3, 2021

Originally opened by @mpvl in cuelang/cue#5

Tracking issue for adding protobuf support to CUE:

  • import command reads text and binary proto instance
  • import command reads proto definitions
  • export command supports the converse
  • core libs
@cueckoo cueckoo added FeatureRequest New feature or request good first issue Good for newcomers protobuf labels Jul 3, 2021
@cueckoo
Copy link
Collaborator Author

cueckoo commented Jul 3, 2021

Original reply by @JohnAZoidberg in cuelang/cue#5 (comment)

What's the status of encoding Cue values as Protobuf?
I'd like to describe my data in cue and dump is as binary using Protobuf.
Should I go through JSON and convert that to Proto3?

@cueckoo
Copy link
Collaborator Author

cueckoo commented Jul 3, 2021

Original reply by @mpvl in cuelang/cue#5 (comment)

It is not implemented so far. Should be straightforward, but stabilizing the new evaluator has priority.

But open to contributions.

@cueckoo
Copy link
Collaborator Author

cueckoo commented Jul 3, 2021

Original reply by @mvdan in cuelang/cue#5 (comment)

In case you're not aware, the new protobuf module has low-level primitive packages for encoding and decoding, for example for arbitrary data in protowire: https://pkg.go.dev/google.golang.org/protobuf@v1.26.0/encoding/protowire

https://pkg.go.dev/google.golang.org/protobuf@v1.26.0/encoding/prototext is message-based instead of token-based, though, so it's unclear if you could use it at all without a schema.

@andreidum
Copy link

Original reply by @mpvl in cuelang/cue#5 (comment)

It is not implemented so far. Should be straightforward, but stabilizing the new evaluator has priority.

Hello, is there any update/estimate on the timelines for this request?

@mvdan mvdan removed the zGarden label Feb 8, 2024
@randomizedcoder
Copy link

With regards to Protobuf support, the documentation has been improved since 2021, but still does not make it clear that Cue can't generate protobuf files form Cue. Cue can import .proto to .cue, but cannot go the other way.
https://cuelang.org/docs/concept/how-cue-works-with-protocol-buffers/

References:
cue-lang/cuelang.org#371
#581
#983

Instead of cue, we have settled for the protobuf validation via:
https://github.com/bufbuild/protovalidate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants