Skip to content

Conversation

@yordis
Copy link
Contributor

@yordis yordis commented Jan 21, 2026

Signed-off-by: Yordis Prieto yordis.prieto@gmail.com

Related to #360 and #409 this is the safest way I found to introduce the feature without making such big assumptions that it wouldn't work.

I have done this professionally for a while using https://hex.pm/packages/trogon_typeprovider

defmodule Umbrella.Grpc.TypeProvider do
  use Trogon.TypeProvider, prefix: "type.googleapis.com/"

  register_type "google.rpc.BadRequest", Google.Rpc.BadRequest
  register_type "google.rpc.ErrorInfo", Google.Rpc.ErrorInfo
  register_type "google.rpc.Status", Google.Rpc.Status

  # ... add more
end

Intentionally, I did not make any assumptions around the type_url as far as I can tell, it is not required to be type.googleapis.com/ prefixed.

  • What about global type provider?

We could make the type provider module optional and fallback to some Application.compiled_env! or something like that, personally, I rather introduce the feature avoiding global assumptions. We can always add a global function that make such assumption instead.

@yordis yordis force-pushed the yordis/any-pack-unpack-1 branch 3 times, most recently from 0266859 to 0011b05 Compare January 21, 2026 01:43
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
@yordis yordis force-pushed the yordis/any-pack-unpack-1 branch from 0011b05 to ce577e9 Compare January 21, 2026 01:46
@yordis yordis changed the title Add unpack/2 to Protobuf.Any with Protobuf.Unpacker behaviour feat: add unpack/2 to Protobuf.Any Jan 21, 2026
@yordis yordis marked this pull request as ready for review January 21, 2026 01:47
@yordis
Copy link
Contributor Author

yordis commented Jan 21, 2026

@whatyouhide here is the follow up work, I did the most safe way I found that would truely work across different projects, which I also tested there.

I did not make assumptions about the prefix because as far as I can tell, we can't, but, correct me here.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant