Enhancements
- ext/typeexpr: Added support for optional object attributes to
TypeConstraint
. Attributes can be wrapped in the specialoptional(…)
modifier, allowing the attribute to be omitted while still meeting the type constraint. For more information, cty's documentation on conversion between object types. (#549) - ext/typeexpr: New function:
TypeConstraintWithDefaults
. In this mode, theoptional(…)
modifier accepts a second argument which can be used as the default value for omitted object attributes. The function returns both acty.Type
and associatedDefaults
, the latter of which has anApply
method to apply defaults to a given value. (#549)