Speakeasy Logo
Skip to Content

Schema keywords

The anyOf keyword

Terraform has limited support for the anyOf keyword due to its type system, which is less flexible than the JSON Schema type system. For instance, managing anyOf with multiple subtypes requires a large set of combined types, leading to practical and implementation challenges.

Consider replacing anyOf in the schema with oneOf or allOf. This adjustment aligns with Terraform’s capabilities, namely, using oneOf for union types and allOf for intersection types.

For more guidance or to discuss schema adaptations, contact our support team at support@speakeasy.com.

The oneOf keyword

In Terraform, the oneOf keyword is defined as a SingleNestedAttribute, where each potential child is represented by a unique key. To ensure compliance with oneOf semantics, Speakeasy adds conflicts-with plan validators to confirm that only one of these keys is active at any given time.

If a oneOf keyword is declared at the root level of an entity, the Speakeasy generator extracts common property attributes and duplicates them into the root level. This is important if, for instance, a common id property is required for making read, update, or delete requests.

The allOf keyword

For the allOf keyword, Speakeasy merges all subschemas into a single combined attribute, creating a unified schema component that encapsulates all specified properties.

Last updated on