<!--
{
  "availability" : [
    "iOS: 26.4.0 -",
    "iPadOS: 26.4.0 -",
    "macCatalyst: 26.4.0 -",
    "macOS: 26.4.0 -",
    "visionOS: 26.4.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "FoundationModels",
  "identifier" : "/documentation/FoundationModels/DynamicGenerationSchema/null",
  "metadataVersion" : "0.1.0",
  "role" : "Type Property",
  "symbol" : {
    "kind" : "Type Property",
    "modules" : [
      "Foundation Models",
      "FoundationModels"
    ],
    "preciseIdentifier" : "s:16FoundationModels23DynamicGenerationSchemaV4nullACvpZ"
  },
  "title" : "null"
}
-->

# null

A schema that represents a null value.

```
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: [])
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)