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

typeexpr: Optional object attributes with defaults #549

Merged
merged 1 commit into from
Sep 1, 2022

Commits on Aug 23, 2022

  1. typeexpr: Optional object attributes with defaults

    This commit extends the type expression package to add two new features:
    
    - In constraint mode, the `optional(...)` modifier can be used on object
      attributes to allow them to be omitted from input values to a type
      conversion process. Any such missing attributes will be replaced with
      a `null` value of the appropriate type upon conversion.
    - In the new defaults mode, the `optional(...)` modifier takes a second
      argument, which accepts a default value of an appropriate type. These
      defaults are returned alongside the type constraint, and may be
      applied prior to type conversion through the new `Defaults.Apply()`
      method.
    
    This change is upstreamed from Terraform, where optional object
    attributes have been available for some time. The defaults functionality
    is new and due to be released with Terraform 1.3.
    alisdair committed Aug 23, 2022
    Configuration menu
    Copy the full SHA
    47464b2 View commit details
    Browse the repository at this point in the history