You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/topics/computed-attributes.mdx
+33-13Lines changed: 33 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,19 +2,36 @@
2
2
title: Computed attributes
3
3
---
4
4
5
-
The computed attributes feature enables the dynamic calculation of attribute values based on user-defined logic. Currently, Infrahub supports two main types of computed attributes: **Jinja2** and **Python**.
5
+
The computed attributes feature enables the dynamic calculation of attribute values based on user-defined logic.
6
+
7
+
Currently, Infrahub supports two main types of computed attributes:
8
+
9
+
***Jinja2** – Lightweight, but limited in relationship handling.
10
+
***Python** – More flexible and powerful, but requires async execution.
11
+
12
+
::::info Limitations
13
+
14
+
Computed attributes have some inherent restrictions due to system constraints and performance considerations. Keep these in mind when designing your schema:
15
+
16
+
* Computed attributes **can only** be used on nodes, not generics.
17
+
* Only `URL` and `Text` attribute kinds are supported for computed attributes.
Users can input a concise Jinja2 template directly within the schema definition. Any change to any field used to compute the value will automatically update it.
10
24
11
25
See the [guide](../guides/computed-attributes) for instructions on creating Jinja2 computed attribute in Infrahub.
12
26
13
-
### Limitations
27
+
### Restrictions
28
+
29
+
::::warning
30
+
31
+
* Jinja2 computed attributes **cannot** reference relationships with cardinality `many`.
32
+
* Only **direct** relationships can be used (i.e., a relationship of a relationship is not accessible).
14
33
15
-
- Jinja2 computed attributes cannot reference relationships with cardinality `many`.
16
-
- Only direct relationships can be used (i.e., a relationship of a relationship is not accessible).
17
-
- Only `URL` and `Text` attribute kinds are supported at the moment.
0 commit comments