---
title: "Generable(description:representNilExplicitlyInGeneratedContent:)"
framework: foundationmodels
role: symbol
role_heading: Macro
path: "foundationmodels/generable(description:representnilexplicitlyingeneratedcontent:)"
---

# Generable(description:representNilExplicitlyInGeneratedContent:)

Conforms a type to Generable protocol.

## Declaration

```swift
@attached(extension, conformances: Generable, names: named(init(_:)), named(generatedContent)) @attached(member, names: arbitrary) macro Generable(description: String? = nil, representNilExplicitlyInGeneratedContent: Bool)
```

## Overview

Overview You can apply this macro to structures and enumerations. @Generable(representNilExplicitlyInGeneratedContent: true) struct Character {   @Guide(description: "A short title")   let title: String

@Guide(description: "An optional short subtitle for the novel")   let subtitle: String?

@Guide(description: "The genre of the novel")   let genre: Genre }

@Generable enum Genre {   case fiction   case nonFiction } The representNilExplicitlyInGeneratedContent argument controls how the model represents nil properties. When false, the model will omit nil properties from the generated content, so no property will be present. When true, the model will produce a property, but its value will be GeneratedContent.Kind.null. // representNilExplicitlyInGeneratedContent: false let content = GeneratedContent(properties: [:])

// representNilExplicitlyInGeneratedContent: true let content = GeneratedContent(properties: ["foo": nil]) Controlling this behavior can be important when interfacing with external systems, using custom adapters, or working with one-shot examples that contain explicitly encoded nils. note: @Generable macro Generable(description:)

## See Also

### Creating a Generable type

- [Generable(description:)](foundationmodels/generable(description:).md)
- [Generable(name:description:representNilExplicitlyInGeneratedContent:)](foundationmodels/generable(name:description:representnilexplicitlyingeneratedcontent:).md)
