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

Move wire_type() to Protobuf, create Protobuf.unknown_fields() type #375

Merged
merged 2 commits into from
Oct 2, 2024

Conversation

v0idpwn
Copy link
Collaborator

@v0idpwn v0idpwn commented Sep 19, 2024

This type is referenced from the typespecs generated by the protoc extension. When building documentation for the protobufs (that is, using include_docs=true), it can't be resolved and ex_doc will print the following warning for every struct:

warning: documentation references type "Protobuf.Wire.Types.wire_type()" but it is hidden or private.

By making it public, the warning is resolved, and it becomes clickable on hexdocs.

Another alternative to solve the issue (while keeping the internal type private) would be to change the typespec of :__unknown_fields__ to avoid referring to it, instead referring to a public type.

This type is referenced from the typespecs generated by the protoc
extension. When building documentation for the protobufs (that is, using
include_docs=true), it can't be resolved and ex_doc will print the
following warning for every struct:

warning: documentation references type "Protobuf.Wire.Types.wire_type()" but
it is hidden or private.

By making it public, the warning is resolved, and it becomes clickable
on hexdocs.

Another alternative to solve the issue (while keeping the internal type
private) would be to change the typespec of `:__unknown_fields__` to avoid
referring to it, instead referring to a public type.
@v0idpwn v0idpwn requested a review from whatyouhide September 19, 2024 21:00
@ericmj
Copy link
Collaborator

ericmj commented Sep 20, 2024

Maybe we should move the type instead? A module with a single type definition would look odd I think and we would have to @doc false the macros.

@v0idpwn
Copy link
Collaborator Author

v0idpwn commented Sep 27, 2024

Thanks, @ericmj, I agree. I just pushed another commit that moves it to Protobuf, and additionally creates a Protobuf.unknown_fields type. I think the unknown_fields type is generally easier to understand than the tuple that existed previously.

@v0idpwn v0idpwn changed the title Make wire type public Move wire_type() to Protobuf, create Protobuf.unknown_fields() type Sep 28, 2024
@v0idpwn v0idpwn merged commit ae14ce6 into main Oct 2, 2024
3 checks passed
@v0idpwn v0idpwn deleted the doc/no-moduledoc-false branch October 2, 2024 12:11
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.

2 participants