question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can I generate messages as a separate project and then reuse these message types for server and client?

See original GitHub issue

I am thinking about the following project structure:

+-- Messages
  |
  +-- messages.proto (compiled)
  +-- service.proto (not compiled, imports `messages.proto`)'
+-- Server (references `Messages` project, so generaetd message could be reused, generates server)
  |
  +-- service.proto (added as a link from `Messages` project)
+-- Client (references `Messages` project, so generaetd message could be reused)
  |
  +-- service.proto (added as a link from `Messages` project, generates client.)

Is it possible to achieve? And if yes, how?

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
chwarrcommented, Nov 22, 2022

I think the Liber example is what you want to do:

The projects here use the GrpcServies metadata that I mentioned before to control what code is compiled into each project to avoid compiling anything twice so you shouldn’t have two types with the same name in different assemblies (and no aliases will be needed).

1reaction
JamesNKcommented, Nov 23, 2022

Messages can be generated on there own. But a client or server is always generated with messages.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reusing and Recycling Data Structures in gRPC Services ...
Here's everything you need to know to create a standard set of reusable message formats to use with your gRPC services.
Read more >
Shared gRPC protobuf files in multiple projects
These reusable messages I would like to put in that shared project I mentioned before and only set links to these files. I...
Read more >
Proto Best Practices
Proto Best Practices · Don't Re-use a Tag Number · Don't Change the Type of a Field · Don't Add a Required Field...
Read more >
A-Z guide to reusability: APIs and integrations
Reusability is when an integration object or process is built and then used several times after its initial use — either by the...
Read more >
Performance best practices with gRPC
A gRPC channel should be reused when making gRPC calls. Reusing a channel allows calls to be multiplexed through an existing HTTP/2 connection....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found