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

TextFormat specification seems to be undocumented #3755

Closed
endobson opened this issue Oct 15, 2017 · 12 comments
Closed

TextFormat specification seems to be undocumented #3755

endobson opened this issue Oct 15, 2017 · 12 comments

Comments

@endobson
Copy link

I'm trying to figure out how to print a protocol buffer in text format that is compatible with the existing implementations of text format. The issue is that I cannot find any specification of TextFormat and only implementations. Given that there are multiple implementations (C++,Java,Go) that are interoperable it seems that there is a spec even if it isn't yet documented.

The binary format and proto file format are all well documented on the developer site:
https://developers.google.com/protocol-buffers.

@liujisi
Copy link
Contributor

liujisi commented Oct 18, 2017

The textformat isn't intended to be interoperable across languages/implementations, and I believe it already isn't fully portable. I'd recommend using binary format for any use cases that require portability.

@endobson
Copy link
Author

I'm implementing support for protocol buffers in a language that doesn't already have support, even if text format isn't fully portable, it is used in many existing systems as a human readable version.

protoc seems to support some version of Text Format for use with the --encode and --decode options. Can that version at least be documented?

@xfxyjwf
Copy link
Contributor

xfxyjwf commented Oct 19, 2017

@endobson If you are implementing protobuf for a new language, can you support proto3 JSON format instead?

@endobson
Copy link
Author

I'll investigate it. That probably is a better choice if protobuf is moving away from the old text format.

@hickford
Copy link

hickford commented Apr 5, 2021

FWIW There exists internal documentation available to Googlers. It might make sense to publish it publically https://b.corp.google.com/issues/173410810 (Googlers only)

https://stackoverflow.com/q/18873924 "what does textproto look like?" is a popular question.

There are over two million textproto files on GitHub https://github.com/search?q=extension%3Apbtxt

@jvolkman
Copy link
Contributor

FWIW There exists internal documentation available to Googlers. It might make sense to publish it publically https://b.corp.google.com/issues/173410810 (Googlers only)

https://stackoverflow.com/q/18873924 "what does textproto look like?" is a popular question

Yes. What's the status on that? I helped write that spec when I was there and would love to see it released.

@y3llowcake
Copy link
Contributor

I, for one, don't love the ergonomics of JSON for human readable and editable applications and would greatly appreciate a documented specification for the text format. For those of us that maintain third party proto implementations and compiler plugins, this would be a useful reference. My use cases are largely human editable config for a single language. Having portability across implementations would be great, but I don't know that it's necessary, at least for the use cases I am thinking of. Also FWIW, it looks like there is now a conformance suite for the text implementation?

@PhilipMetzger
Copy link

I'm also a fan of textproto for human writeable and readable configuration files , since it doesn't have any of JSON downfalls, an actual number type. I and many others would appreciate a OSS Release of the textproto Spec.

There are currently about 2.3 Million files on Github which implicitly depend on this spec.

AFAIU there's an internal spec available at go/textproto-spec, which is under further discussion at b/173410810 (Googler only)

Queries:

@tarndt
Copy link

tarndt commented Feb 16, 2022

The Go (golang) implementation seems to know how to marshal to and from the textual format. I presume they must have implemented this to some defined standard?

Old/v1:

Current/v2:

The docs above do contain this warning:

Do not depend on the output being stable. It may change over time across different versions of the program.

@jvolkman
Copy link
Contributor

The defacto spec is the c++ implementation. That's what everything else is based on, including the aforementioned internal spec (at least that was the case when I was there 3 years ago). The v2 go implementation was made in conjunction with the reverse-engineered internal spec.

@sxlijin
Copy link

sxlijin commented Mar 1, 2022

Is there any chance we can get this reopened? It's unclear to me why this was closed.

Some of the C++ gRPC folks might be in the right place to get this moving again (unless there's a dedicated C++ proto team- I don't remember if there was one when I left last year).

@jvolkman
Copy link
Contributor

jvolkman commented Mar 1, 2022

There's a newer, open issue at #8636

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

No branches or pull requests