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

Is there any kotlin class generator based on .proto file available? #477

Closed
acc110789 opened this issue May 31, 2019 · 7 comments
Closed

Comments

@acc110789
Copy link

acc110789 commented May 31, 2019

just as title

@qwwdfsad
Copy link
Collaborator

qwwdfsad commented Jun 2, 2019

There isn't any and we have no plans to add it in the nearest future.

This project has a purpose drastically different from the original Protobuf: Kotlin-first data model that is format-agnostic and can be shared between all the platforms Kotlin supports.
Kotlin classes are the core of the application data model, not the formats or schemas.

Protobuf inverses this principle: .proto file is the core of the data model and every "backend" (language, service, w/e) decides exactly to process it complying the given schema.

What we have in mind is generating .proto files from the given serializable Kotlin class, so it's possible to share (Kotlin-first) schema with other languages if there is need for.

@mikezliu
Copy link

mikezliu commented Oct 4, 2020

Any idea when we will be able to generate .proto from kotlin files? I'm working on a project that has a front-end (vue), iOS, and we only want to keep one source of truth for proto files, which currently seems like we must use .proto files rather the kotlin data classes.

@qwwdfsad
Copy link
Collaborator

qwwdfsad commented Oct 4, 2020

Probably around 1.1.0, probably the end of this year

@Marlinski
Copy link

Hi, any update about this issue ?

@qwwdfsad
Copy link
Collaborator

We have a prototype of .proto file generator that is aiming for the next release: #1255

We do not plan to implement .proto -> Kotlin conversion tho, for that purpose, I'd recommend using third-party solutions such as https://github.com/streem/pbandk

@Marlinski
Copy link

I am actually interested in having .proto file generated from my @serializable data class. This is because I was using serialization-protobuf library but then those data class needed to be sent over the wire to a backend in golang and I unfortunately had to redo all my classes the old way instead to make it work (with .proto and protobuf-lite).

Happy to see the generator for the next release!

@Dogacel
Copy link
Contributor

Dogacel commented Aug 13, 2023

Hi, I am actually working on a project to auto-generate kotlin classes from .proto that are @Serializable. It is a very new project and I am waiting for your feedbacks and contributions 🙏

On the way, I have realized several bugs and missing features on kotlinx.serialization part as well. I am hoping we can leverage each other's code quality while I am working on this project by fixing bugs and implementing missing features.

https://github.com/Dogacel/kotlinx-protobuf-gen

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

No branches or pull requests

5 participants