-
Notifications
You must be signed in to change notification settings - Fork 635
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
Generator for .proto files based on serializable Kotlin classes #1255
Conversation
120115d
to
60edb7a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Publication seems to fail on CI — can you check it?
...ats/protobuf-generator/commonMain/src/kotlinx.serialization.protobuf.generator/Generation.kt
Outdated
Show resolved
Hide resolved
...ats/protobuf-generator/commonMain/src/kotlinx.serialization.protobuf.generator/Generation.kt
Outdated
Show resolved
Hide resolved
...ats/protobuf-generator/commonMain/src/kotlinx.serialization.protobuf.generator/Generation.kt
Outdated
Show resolved
Hide resolved
...ats/protobuf-generator/commonMain/src/kotlinx.serialization.protobuf.generator/Generation.kt
Outdated
Show resolved
Hide resolved
...ats/protobuf-generator/commonMain/src/kotlinx.serialization.protobuf.generator/Generation.kt
Outdated
Show resolved
Hide resolved
...ats/protobuf-generator/commonMain/src/kotlinx.serialization.protobuf.generator/Generation.kt
Outdated
Show resolved
Hide resolved
...ats/protobuf-generator/commonMain/src/kotlinx.serialization.protobuf.generator/Generation.kt
Outdated
Show resolved
Hide resolved
formats/protobuf-generator/jvmTest/resources/FieldNumberClass.proto
Outdated
Show resolved
Hide resolved
formats/protobuf-generator/jvmTest/resources/AbstractHolder.proto
Outdated
Show resolved
Hide resolved
...ts/protobuf-generator/jvmTest/src/kotlinx/serialization/protobuf/generator/GenerationTest.kt
Outdated
Show resolved
Hide resolved
28e0fff
to
a8d794a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still not sure if we should mangle incorrect serial names instead of throwing an exception
...ats/protobuf-generator/commonMain/src/kotlinx.serialization.protobuf.generator/Generation.kt
Outdated
Show resolved
Hide resolved
...ats/protobuf-generator/commonMain/src/kotlinx.serialization.protobuf.generator/Generation.kt
Outdated
Show resolved
Hide resolved
...ats/protobuf-generator/commonMain/src/kotlinx.serialization.protobuf.generator/Generation.kt
Outdated
Show resolved
Hide resolved
...ats/protobuf-generator/commonMain/src/kotlinx.serialization.protobuf.generator/Generation.kt
Outdated
Show resolved
Hide resolved
...ts/protobuf-generator/jvmTest/src/kotlinx/serialization/protobuf/generator/GenerationTest.kt
Outdated
Show resolved
Hide resolved
...ats/protobuf-generator/commonMain/src/kotlinx.serialization.protobuf.generator/Generation.kt
Outdated
Show resolved
Hide resolved
Also, please investigate why the build is failing |
558e896
to
2d8aafc
Compare
2d8aafc
to
65d6348
Compare
65d6348
to
3c6cabe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job! What's left to do is to tide up warning messages, finish documentation and come up with a good name
// WARNING: This field is marked as nullable but it does not support null values | ||
repeated int32 key = 1; | ||
// WARNING: This field is marked as nullable but it does not support null values | ||
repeated int32 value = 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to duplicate these classes in both this one and individual files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is worth adding reading data from classes generated by protoc. For protoc to work, it is necessary that messages do not repeat in files - the easiest way to achieve this is by generating just one common proto file.
M.b. it should be implemented later.
formats/protobuf/commonMain/src/kotlinx/serialization/protobuf/schema/Generation.kt
Outdated
Show resolved
Hide resolved
formats/protobuf/commonMain/src/kotlinx/serialization/protobuf/schema/Generation.kt
Outdated
Show resolved
Hide resolved
formats/protobuf/commonMain/src/kotlinx/serialization/protobuf/schema/Generation.kt
Outdated
Show resolved
Hide resolved
formats/protobuf/commonMain/src/kotlinx/serialization/protobuf/schema/Generation.kt
Outdated
Show resolved
Hide resolved
formats/protobuf/commonMain/src/kotlinx/serialization/protobuf/schema/Generation.kt
Outdated
Show resolved
Hide resolved
formats/protobuf/commonMain/src/kotlinx/serialization/protobuf/schema/Generation.kt
Outdated
Show resolved
Hide resolved
formats/protobuf/commonMain/src/kotlinx/serialization/protobuf/schema/Generation.kt
Outdated
Show resolved
Hide resolved
formats/protobuf/commonMain/src/kotlinx/serialization/protobuf/schema/Generation.kt
Outdated
Show resolved
Hide resolved
formats/protobuf/commonMain/src/kotlinx/serialization/protobuf/schema/Generation.kt
Outdated
Show resolved
Hide resolved
formats/protobuf/commonMain/src/kotlinx/serialization/protobuf/schema/Generation.kt
Outdated
Show resolved
Hide resolved
formats/protobuf/commonMain/src/kotlinx/serialization/protobuf/schema/Generation.kt
Outdated
Show resolved
Hide resolved
formats/protobuf/commonMain/src/kotlinx/serialization/protobuf/schema/Generation.kt
Outdated
Show resolved
Hide resolved
formats/protobuf/commonMain/src/kotlinx/serialization/protobuf/schema/Generation.kt
Outdated
Show resolved
Hide resolved
formats/protobuf/commonMain/src/kotlinx/serialization/protobuf/schema/Generation.kt
Outdated
Show resolved
Hide resolved
formats/protobuf/commonMain/src/kotlinx/serialization/protobuf/schema/Generation.kt
Outdated
Show resolved
Hide resolved
formats/protobuf/commonMain/src/kotlinx/serialization/protobuf/schema/Generation.kt
Outdated
Show resolved
Hide resolved
c15c454
to
7fd492a
Compare
7fd492a
to
741e66b
Compare
* More granular documetation * Convinience method with single descriptor * Alll the implementation is encapsulated into the object body
...ats/protobuf/commonMain/src/kotlinx/serialization/protobuf/schema/ProtoBufSchemaGenerator.kt
Outdated
Show resolved
Hide resolved
...ats/protobuf/commonMain/src/kotlinx/serialization/protobuf/schema/ProtoBufSchemaGenerator.kt
Outdated
Show resolved
Hide resolved
...ats/protobuf/commonMain/src/kotlinx/serialization/protobuf/schema/ProtoBufSchemaGenerator.kt
Outdated
Show resolved
Hide resolved
Several typos in the commit message of the "Schema generator improvements" commit @qwwdfsad FYI. Didn't check code changes because I'm on mobile, and the app won't let me see the "large diff". |
...ats/protobuf/commonMain/src/kotlinx/serialization/protobuf/schema/ProtoBufSchemaGenerator.kt
Show resolved
Hide resolved
...ats/protobuf/commonMain/src/kotlinx/serialization/protobuf/schema/ProtoBufSchemaGenerator.kt
Show resolved
Hide resolved
...ats/protobuf/commonMain/src/kotlinx/serialization/protobuf/schema/ProtoBufSchemaGenerator.kt
Outdated
Show resolved
Hide resolved
...ats/protobuf/commonMain/src/kotlinx/serialization/protobuf/schema/ProtoBufSchemaGenerator.kt
Outdated
Show resolved
Hide resolved
...ats/protobuf/commonMain/src/kotlinx/serialization/protobuf/schema/ProtoBufSchemaGenerator.kt
Outdated
Show resolved
Hide resolved
* has the following list of restrictions: | ||
* | ||
* * Serial name of the class and all its fields should be a valid Proto [identifier](https://developers.google.com/protocol-buffers/docs/reference/proto2-spec) | ||
* * Nullable values are allowed only for Kotlin [nullable][SerialDescriptor.isNullable] types, but not [optional][SerialDescriptor.isElementOptional] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the restriction of encoder, not schema generator, isn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's still worth mentioning it here unless we have our ProtoBuf doc rephrased
Resolves #34