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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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

Copy link
Contributor Author

OwenKephart commented Dec 20, 2024

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?

return self._resolve(val, [], should_render=should_render)


def has_required_scope(
Copy link
Member

Choose a reason for hiding this comment

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

I think part of my confusion is that this function name is a bit ambigious. Does it mean that there is a field that has the RenderingScope attribute?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does it mean that there is a field that has the RenderingScope attribute?

That's right yeah -- basically should_render is a function that reads the json schema and determines if anything along the path has some required scope

Copy link
Member

Choose a reason for hiding this comment

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

has_rendering_scope?

@OwenKephart OwenKephart force-pushed the 12-20-_components_templating_for_asset_attributes branch from 38baab7 to 67dc5d0 Compare December 20, 2024 20:55
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