Closed boukeversteegh closed 10 months ago
@boukeversteegh I saw you are involve in the some issues related to the support of Any
type.
Do you know if there's some news for supporting Any
in the coming releases ?
For whoever picks this up, in issue #310 I suggested also updating the code examples in the docstring to be betterproto style code instead of C++, Java, and google-Python.
Another example:
syntax = "proto3";
message MyMessage {
// JSON data in the following format:
// {
// "name": "Foo",
// "age": 0,
// "job": {
// "area": "Bar",
// "salary": 0
// }
// }
string json = 1;
}
# Generated by the protocol buffer compiler. DO NOT EDIT!
# sources: mymessage.proto
# plugin: python-betterproto
from dataclasses import dataclass
import betterproto
@dataclass(eq=False, repr=False)
class MyMessage(betterproto.Message):
json: str = betterproto.string_field(1)
"""
JSON data in the following format: { "name": "Foo", "age": 0,
"job": { "area": "Bar", "salary": 0 } }
"""
It's great that it detects the comments and turns them into docstrings, but it breaks the formatting. I'd like to get the following result:
# Generated by the protocol buffer compiler. DO NOT EDIT!
# sources: mymessage.proto
# plugin: python-betterproto
from dataclasses import dataclass
import betterproto
@dataclass(eq=False, repr=False)
class MyMessage(betterproto.Message):
json: str = betterproto.string_field(1)
"""
JSON data in the following format:
{
"name": "Foo",
"age": 0,
"job": {
"area": "Bar",
"salary": 0
}
}
"""
Adding that there are examples of this already in the existing tests:
This was fixed in #532
Any reason the tests pass if the generated example in master
does not appear to have this fix?
I'm not entirely sure we test it but also testing stability of comments seems very fragile.
Compare line breaks in comments 👇