Repository navigation
refactor(create): declare template vars via resolver map - #1787
Draft
marcossevilla wants to merge 3 commits into
Draft
marcossevilla wants to merge 3 commits into
marcossevilla wants to merge 3 commits into
Conversation
Template vars were built imperatively in getTemplateVars() with `this is X` branches and per-command overrides, so the set of vars a command handles was not declared anywhere. Introduce CreateSubCommand.templateVarResolvers, a map from brick var name to a lazy resolver. Mixins and subcommands extend it, and getTemplateVars() is now @nonvirtual and computed from it, dropping null results so unset optional vars (e.g. application_id) still fall back to template defaults. Because resolvers are closures, the handled var names can be read without parsing arguments, which enables checking them against bundle vars.
This branch has not been deployed
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.
Status
READY
Description
Part 1/3 of stack #1790 (template vars check).
Template vars were built imperatively in
getTemplateVars()withthis is Xbranches and per-command overrides, so the set of vars a command handles was not declared anywhere.CreateSubCommand.templateVarResolvers: a map from brick var name to a lazy resolver.OrgName,Publishable,Workspaceand the subcommands extend it with{...super.templateVarResolvers, ...}.getTemplateVars()is now@nonVirtualand computed from the map, droppingnullresults so unset optional vars (e.g.application_id) still fall back to template defaults.No behavior change: existing exact
varsassertions pass unchanged.Type of Change