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: enabled
kind: Boolean
Sync Config
- name: InfraInterface
transforms:
- field: l1
expression: '{{ "true" if "up" in l1 else "false" }}'
mapping: ...
fields:
- name: enabled
mapping: 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:
- name: InfraInterface
transforms:
- field: l1
expression: '{{ "true" if "up" in l1 else "false" }}'
kind: Boolean
mapping: ...
fields:
- name: enabled
mapping: l1
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.