Schema Keywords
Tip
This section is not an exhaustive list of available keyword options. If you’re unsure whether a keyword is supported, please reach out to our team at support@speakeasy.com.
The anyOf
Keyword
Terraform has limited support for the anyOf
keyword due to its less flexible type system than JSON Schema. For instance, managing anyOf
with multiple subtypes requires a large set of combined types, leading to practical and implementation challenges.
Consider replacing anyOf
in your schema with oneOf
or allOf
. This adjustment aligns with Terraform’s capabilities: 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, oneOf
is defined as a SingleNestedAttribute
where each potential child is represented by a unique key. To ensure compliance with oneOf
semantics, conflicts-with
plan validators are added to confirm that only one of these keys is active at any given time.
If a oneOf
is declared at the root level of an entity, the Speakeasy generator will extract common property attributes and duplicate them into the root level. This is important if, for instance, a common id
property is required for making read, update, or delete requests.
Hoisting of common fields in oneOf
When common fields exist across the different schemas within a oneOf
definition, Speakeasy intentionally hoists these fields to the root level of the generated Terraform resource or data source. This provides a deterministic way to access these common fields, regardless of which specific oneOf
option is active. This behavior is a feature designed to improve the usability of the generated provider.
The allOf
Keyword
For allOf
, Speakeasy merges all sub-schemas into a single combined attribute, creating a unified schema component that encapsulates all specified properties.