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

[components] Templating for asset_attributes #26633

Merged

Conversation

OwenKephart
Copy link
Contributor

Summary & Motivation

This adds a rendering scope to AssetAttributes, allowing its values to depend on the spec that's currently being evaluated. This is useful for setting properties of a spec based off of other properties (e.g. based off of a tag, set an automation condition)

Refactors component_rendering.py to be more class-based

How I Tested These Changes

Changelog

NOCHANGELOG

self,
val: Any,
valpath: Optional[Sequence[Union[str, int]]],
should_render: Callable[[Sequence[Union[str, int]]], bool],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not following this should_render stuff. Under what conditions will this be true versus false?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still finding this code path quite confusing given what is happening here should be pretty straightforward?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the names in the PR and added some comments, but basically there's just two options for the should_render function:

  1. a function that always returns true (this is what translators and the like use -- they will greedily render any values they come across)
  2. a function that inspects the json schema of the target params type to determine if we're deferring or not (this is what we use in the pre-processing stage to keep some fields unrendered)

@OwenKephart OwenKephart force-pushed the 12-20-_components_templating_for_asset_attributes branch from 38baab7 to 67dc5d0 Compare December 20, 2024 20:55
Copy link
Member

@schrockn schrockn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Req'ing changes based on naming of has_required_scope

@OwenKephart OwenKephart force-pushed the 12-20-_components_templating_for_asset_attributes branch from 67dc5d0 to 3deb344 Compare December 23, 2024 20:48
@OwenKephart OwenKephart requested a review from schrockn December 23, 2024 20:52
@OwenKephart OwenKephart force-pushed the 12-20-_components_templating_for_asset_attributes branch from 3deb344 to 7eb1d13 Compare December 23, 2024 22:04
@OwenKephart OwenKephart force-pushed the 12-20-_components_templating_for_asset_attributes branch from 7eb1d13 to 8fb785a Compare December 30, 2024 15:41
Copy link
Member

@schrockn schrockn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

req'ing changes until see the new alternative structure with explicit standalone schema upstack.

@OwenKephart OwenKephart force-pushed the 12-20-_components_templating_for_asset_attributes branch from 8fb785a to f4d3125 Compare December 30, 2024 22:37
Copy link
Contributor Author

OwenKephart commented Dec 31, 2024

Merge activity

  • Dec 31, 11:02 AM EST: A user started a stack merge that includes this pull request via Graphite.
  • Dec 31, 11:03 AM EST: Graphite rebased this pull request as part of a merge.
  • Dec 31, 11:05 AM EST: A user merged this pull request with Graphite.

@OwenKephart OwenKephart force-pushed the 12-20-_components_templating_for_asset_attributes branch from f4d3125 to c4b98aa Compare December 31, 2024 16:03
@OwenKephart OwenKephart merged commit 423f0f4 into master Dec 31, 2024
1 check was pending
@OwenKephart OwenKephart deleted the 12-20-_components_templating_for_asset_attributes branch December 31, 2024 16:05
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