[hooks] Add baseUri to user defines - #3522
Open
simolus3 wants to merge 6 commits into
Open
Conversation
simolus3
marked this pull request as ready for review
August 5, 2026 13:57
dcharkes
reviewed
Aug 5, 2026
| ); | ||
| } | ||
|
|
||
| final pathOption = |
Collaborator
There was a problem hiding this comment.
Lol, now accessing baseUri is easier than the user-defines themselves 😄
Contributor
Author
There was a problem hiding this comment.
I can add a helper that traverses through options and returns the original define, but I suspect most hooks with complex options would use helper packages like json_serializable for this anyway.
Collaborator
|
@goderbauer See related bug. Any preferences for an API? |
baseUriForDefine to user definesbaseUriForDefine to user defines
baseUriForDefine to user definesbaseUri to user defines
simolus3
commented
Aug 5, 2026
simolus3
left a comment
Contributor
Author
There was a problem hiding this comment.
The changelog check fails because it expects a hooks_runner entry due to the test_data/ change, could I get a skip-changelog-check label for this?
goderbauer
reviewed
Aug 6, 2026
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.
Description
This adds
baseUriForDefineto HookInputUserDefines`, which returns a base URI that can be used to interpret arbitrary configuration values as paths.Additionally, it accepts a list of keys, which allows traversing through nested options (yaml maps and sequences). Path elements are either strings (used to lookup values in maps) or integers (for lookups in sequences).
This is a generalization of
HookInputUserDefines.path, which allows interpreting a top-level user-define as a path.baseUriForDefinealso works for nested paths and can be used to transform lists, maps or any other structure a hook might read as user-defines.Related Issues
Fixes #3515
PR Checklist
dart tool/ci.dart --alllocally and resolved all issues identified. (Too lazy, I just ran the formatter and checked for analysis errors)CHANGELOG.mdfor the relevant packages. (Not needed for small changes such as doc typos).