Allow defining default values for properties. For example, we could define that the default value of primary_key is `false:
object_type: dimension {
property: type {
type: dimension_field_type
}
property: sql {
type: code
}
property: label {
type: string
}
property: primary_key {
type: boolean
default: "false"
}
property: tags {
type: string_list
}
}
Defaults would only be allowed for properties of type string, number and an enum type defined in the schema, such as 'boolean'.
In the schema, defaults are always strings. The schema loader must check that they are valid (valid numbers, valid members of their enum).
If a property has a default, the value of cardinality is ignored. The user does not need to specify the property, and the consumer can assume that it is present. (In future, we may add a newcardinality value implied alongside required and optional.)
In LookmlSchemas.ObjectTypeBuilder, add method withDefaultValue. As for the existing method withCardinality, withDefaultValue applies to the previously added property, and throws if there was no previous property.
Allow defining default values for properties. For example, we could define that the default value of
primary_keyis `false:Defaults would only be allowed for properties of type string, number and an enum type defined in the schema, such as 'boolean'.
In the schema, defaults are always strings. The schema loader must check that they are valid (valid numbers, valid members of their enum).
If a property has a default, the value of
cardinalityis ignored. The user does not need to specify the property, and the consumer can assume that it is present. (In future, we may add a newcardinalityvalueimpliedalongsiderequiredandoptional.)In
LookmlSchemas.ObjectTypeBuilder, add methodwithDefaultValue. As for the existing methodwithCardinality,withDefaultValueapplies to the previously added property, and throws if there was no previous property.