<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "FoundationModels",
  "identifier" : "/documentation/FoundationModels/GenerationSchema",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Foundation Models"
    ],
    "preciseIdentifier" : "s:16FoundationModels16GenerationSchemaV"
  },
  "title" : "GenerationSchema"
}
-->

# GenerationSchema

A type that describes the properties of an object and any guides
on their values.

```
struct GenerationSchema
```

## Overview

Generation schemas guide the output of a language model to deterministically
ensure the output is in the desired format.

## Topics

### Creating a generation schema

[`init(root:dependencies:)`](/documentation/FoundationModels/GenerationSchema/init(root:dependencies:))

Creates a schema by providing an array of dynamic schemas.

[`init(type:description:anyOf:)`](/documentation/FoundationModels/GenerationSchema/init(type:description:anyOf:))

Creates a schema for a string enumeration.

[`init(type:description:properties:)`](/documentation/FoundationModels/GenerationSchema/init(type:description:properties:))

Creates a schema by providing an array of properties.

[`init(type:description:representNilExplicitlyInGeneratedContent:properties:)`](/documentation/FoundationModels/GenerationSchema/init(type:description:representNilExplicitlyInGeneratedContent:properties:))

Creates a schema by providing an array of properties.

[`GenerationSchema.Property`](/documentation/FoundationModels/GenerationSchema/Property)

A named, strongly typed member of an object type with an optional description and guides.

### Accessing the name

[`name`](/documentation/FoundationModels/GenerationSchema/name)

The name of this generation schema.

### Errors

[`GenerationSchema.SchemaError`](/documentation/FoundationModels/GenerationSchema/SchemaError)

An error that occurs when there is a problem creating a generation schema.



---

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)