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.

Automatic message registry

See original GitHub issue

It will be hugely beneficial if we can create a registry of all proto messages automatically so that we don’t need to pass typeRegistry for the Any type which is kind of annoying and hard to maintain.

The protobuf golang implementation does exactly this, whenever a proto generated file is imported it has line at the top of the file, something like:

registry.Register("ProtoMessage", ProtoMessage);

in fact the Any types are always automatically handled as far as the file is imported (and registered).

Definately a great development experience.

We can of course keep the typeRegistry option if we ever need to pass those manually in, otherwise it passes the registry by default

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
timostammcommented, Jul 17, 2021

I’ve seen this from a different perspective so far: Users have to import to register anyway - so it can just as well be completely explicit. This works out best in C#, where users can easily scan an assembly for messages and register. No funny import side effects, no need to maintain.

I see your point though, and think this is beneficial. It would just need

  • a globalTypeRegistry, exported from @protobuf-ts/runtime,
  • a globalTypeRegistry.push for each export const MyMessage in generated code
  • support in JSON read / write, probably simply by setting the default value for typeRegistry to the global one.

It would also need proper testing, and a documentation update. I’m super constrained at the moment, but if you could PR this I can take care of the docs.

2reactions
fenoscommented, Jul 22, 2021

@timostamm I’ll try to PR this weekend

Read more comments on GitHub >

github_iconTop Results From Across the Web

Automatic Replies (Out of Office) Not Working
Keep getting error message when trying to set Automatic Replies (Out of Office) see ... Locate and then click the following registry subkey:....
Read more >
Send An Automated SMS Message When Registering A New ...
In this article, we show how easy it is to send an SMS message upon a new user registration using our Zapier integration....
Read more >
Using the Message Registry - Oracle Help Center
The Message Registry works only for Dynamo Messages—that is, messages that adhere to the ... The Message Registry does this automatically, by default....
Read more >
Setting Up an Autoresponder or Auto-reply
Instructions on how to set up an email autoresponder or out-of-office reply. Domain Registration Services' email auto-reply feature is very powerful and ...
Read more >
How do I add a warning Logon message? - ITPro Today
Start the registry editor (regedit) · Move to HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Winlogon · Double Click the "LegalNoticeCaption", ...
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