-
Notifications
You must be signed in to change notification settings - Fork 34
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
Get Repository Name #131
Get Repository Name #131
Conversation
Thank you for the PR! Let's hold off on it for a moment given this comment https://github.com/hexpm/hex/pull/931/files#r803454950 |
@wojtekmach Not sure if you wanted to go ahead and include |
@aj-foster perfect, thank you! Could you do the same thing for functions for other registry files, that is |
Sure thing. I went ahead and had each decoder return all of the top-level keys from each file ( |
src/hex_registry.erl
Outdated
#{repository := Repository, packages := Packages} = hex_pb_names:decode_msg(Payload, 'Names'), | ||
{ok, #{repository => Repository, packages => Packages}}; |
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.
hmm, actually should we just go with this?
#{repository := Repository, packages := Packages} = hex_pb_names:decode_msg(Payload, 'Names'), | |
{ok, #{repository => Repository, packages => Packages}}; | |
{ok, hex_pb_names:decode_msg(Payload, 'Names')}. |
as long as it's safe, i.e. decode_msg doesn't return an error tuple or something?
in hindsight, it was a big mistake to initially return just the subset of the protobuf, just the packages field. With this change we're in sync with the protobuf which means if we ever add another field, we'll immediately start returning it here.
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.
Went ahead and made this change in 85e5964 — easy to revert if necessary. I also made the similar change to decode_versions/2
and decode_package/3
.
Edit: there was a choice to make for the "verified" function clause, which could use review. I have it verifying the same fields for now.
Thank you! Seems there are some transient issues on CI so I'll merge this afterwards. |
Thank you! |
This PR is related to hexpm/hex#931.
In order to enable the modification of hex repositories without the need for a--name
flag, this change addshex_registry:get_repository_name/2
.After further discussion, this PR makes a breaking change to the return type of several registry-reading functions to return additional information that may be useful in the future.