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
The addition of SchemaMappingTransform is wonderful however it will always return a string.
There are some reasons why you might not want to return a string. Such as in IP Fabrics case we display an interface state as up or down. But I need to be able to convert it to a boolean for a generic InfrahubSchema to be useful to anyone.
Interface Schema:
attributes:
- name: enabledkind: Boolean
Sync Config
- name: InfraInterfacetransforms:
- field: l1expression: '{{ "true" if "up" in l1 else "false" }}'mapping: ...fields:
- name: enabledmapping: l1
Returning a string will fail as enabled expects a Boolean. If there was a way to define the kind in the transforms like so:
Then it would be good to convert the string to another type allowing yes/no or true false, if kind is Number then it converts the string to an int if its valid for the infrahub schema.
The text was updated successfully, but these errors were encountered:
The addition of SchemaMappingTransform is wonderful however it will always return a string.
There are some reasons why you might not want to return a string. Such as in IP Fabrics case we display an interface state as
up
ordown
. But I need to be able to convert it to a boolean for a generic InfrahubSchema to be useful to anyone.Interface Schema:
Sync Config
Returning a string will fail as enabled expects a
Boolean
. If there was a way to define the kind in the transforms like so:Then it would be good to convert the string to another type allowing yes/no or true false, if kind is
Number
then it converts the string to an int if its valid for the infrahub schema.The text was updated successfully, but these errors were encountered: