null
Creates a null schema.
Declaration
static var null: DynamicGenerationSchema { get }Discussion
You can use null schemas as a way to express types that cannot be absent, but may have an empty value.
let person = DynamicGenerationSchema(
name: "Person",
properties: []
DynamicGenerationSchema.Property(
name: "fullName",
schema: DynamicGenerationSchema(type: String.self)
)
]
)
let nullablePerson = DynamicGenerationSchema(
name: "NullablePerson",
anyOf: [person, .null]
)
let schema = try GenerationSchema(root: nullablePerson, dependencies: [])