Support records format and flexible gpb options#23
Open
7run wants to merge 1 commit intotsloughter:masterfrom
Open
Support records format and flexible gpb options#237run wants to merge 1 commit intotsloughter:masterfrom
7run wants to merge 1 commit intotsloughter:masterfrom
Conversation
- Remove hardcoded 'maps' option to allow records format
- Remove hardcoded '{i, "."}' to let users specify include paths
- Fix relative paths (o_hrl, i) to be absolute based on app directory
- Add o_hrl directory to include path for compilation
- Support both map and tuple formats in resolve_method/2
- Update gpb dependency to 4.21.5 for Erlang syntax compatibility
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Currently, the plugin hardcodes
mapsand{i, "."}in the gpb compile options, which prevents users from using the records format and limits control over include paths.This PR makes the following changes:
mapsoption — Allow users to choose between maps and records format via their owngpb_optsconfiguration{i, "."}— Let users specify proper include paths throughgpb_optso_hrlandipaths ingpb_optsto be relative to the application's base directory, preventing issues in umbrella projects or non-standard directory layoutsresolve_method/2— When using records mode, gpb returns method data as tuples ({rpc, Name, Input, Output, ...}) instead of maps. This adds a function clause to handle the tuple formatBackward Compatibility
Existing users who rely on the default maps behavior are not affected. The
use_packagesandstrings_as_binariesoptions remain as defaults. Users who want records format can now simply addrecords(or omitmaps) in theirgpb_opts.Related
This is related to #14, which also addresses GPB option flexibility, though with a different approach.