Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

Document nullable types and explicit null overrides

Summary

Added comprehensive documentation for the nullable<T> type in Fern's type system documentation. This PR addresses the need to document explicit null overrides for APIs that distinguish between omitted fields, explicit null values, and actual values (particularly important for PATCH requests).

Changes:

  • Added nullable to the built-in types table
  • Created new "Optional vs Nullable" section explaining the distinction between optional<T> and nullable<T>
  • Added examples showing PATCH request semantics with both TypeScript and Java SDK usage
  • Documented combining optional and nullable for three-state fields

Review & Testing Checklist for Human

Risk Level: Yellow - Unable to access original Slack thread, so requirements may be incomplete or misaligned

  • Verify technical accuracy: Check that the nullable type explanation is correct and matches current SDK behavior, especially the Java OptionalNullable example with the collapse-optional-nullable config
  • Review against Slack thread: Compare this documentation against what was requested in the Slack thread to ensure it addresses the actual requirements
  • Test documentation rendering: Build and preview the docs to ensure the new section renders correctly with proper formatting and code highlighting
  • Check SDK-specific docs: Determine if SDK-specific documentation (TypeScript, Java, Go, etc.) also needs updates to reference or expand on nullable types
  • Verify examples compile: Test that the TypeScript and Java code examples are syntactically correct and represent current SDK usage patterns

Recommended Test Plan

  1. Build the docs locally and verify the new section renders correctly
  2. Cross-reference with recent SDK changelogs to ensure examples match current behavior
  3. If possible, test the provided code examples in actual SDK projects to verify they work

Notes

  • Session: https://app.devin.ai/sessions/e047bf09d7524294b32a073866fe6634
  • Requested by: Devin Logan ([email protected]) via Slack
  • The original Slack thread was not accessible, so I inferred requirements from:
    • Compile failure in Vercel TypeScript SDK showing duplicate slug properties
    • SDK changelog entries documenting nullable feature additions
    • General understanding of PATCH request semantics
  • The Java example references OptionalNullable which I found in the Java SDK changelog (v3.11.0) but haven't verified firsthand
  • Only updated the main types documentation; SDK-specific guides may also need updates

- Add nullable<T> to built-in types table
- Document the difference between optional and nullable
- Explain PATCH request semantics with explicit null values
- Provide TypeScript and Java SDK usage examples
- Document combining optional and nullable for three-state fields

This addresses the need to document explicit null overrides for APIs that
need to differentiate between omitted fields, explicit null values, and
actual values in PATCH requests.

Co-Authored-By: Devin Logan <[email protected]>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

| `file` | File upload type, e.g., [file uploads](/learn/api-definition/fern/endpoints/multipart) |
| `unknown` | Represents arbitrary JSON |

### Optional vs Nullable
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [vale] reported by reviewdog 🐶
[FernStyles.Headings] 'Optional vs Nullable' should use sentence-style capitalization.


### Optional vs Nullable

Understanding the difference between `optional` and `nullable` is important for properly modeling your API:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [vale] reported by reviewdog 🐶
[FernStyles.Adverbs] Remove 'properly' if it's not important to the meaning of the statement.


Understanding the difference between `optional` and `nullable` is important for properly modeling your API:

- **`optional<T>`**: The field can be omitted from the request/response entirely. When omitted, the field is not sent over the wire.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [vale] reported by reviewdog 🐶
[Microsoft.Contractions] Use 'isn't' instead of 'is not'.

bio: nullable<string> # Must be present, but can be null
```
This distinction is particularly important for PATCH requests where you need to differentiate between:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [vale] reported by reviewdog 🐶
[FernStyles.Acronyms] 'PATCH' has no definition.

2. **Setting to `null`** - Clear this field (remove the value)
3. **Setting to a value** - Update this field with a new value

#### Example: PATCH request semantics
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [vale] reported by reviewdog 🐶
[FernStyles.Headings] 'Example: PATCH request semantics' should use sentence-style capitalization.

2. **Setting to `null`** - Clear this field (remove the value)
3. **Setting to a value** - Update this field with a new value

#### Example: PATCH request semantics
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [vale] reported by reviewdog 🐶
[FernStyles.Acronyms] 'PATCH' has no definition.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 5, 2025

- Change heading to sentence-style capitalization
- Remove unnecessary adverb 'properly'
- Use contraction 'isn't' instead of 'is not'
- Add 'HTTP' prefix to PATCH to clarify acronym

Co-Authored-By: Devin Logan <[email protected]>
bio: nullable<string> # Must be present, but can be null
```
This distinction is particularly important for HTTP PATCH requests where you need to differentiate between:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [vale] reported by reviewdog 🐶
[FernStyles.Acronyms] 'PATCH' has no definition.

2. **Setting to `null`** - Clear this field (remove the value)
3. **Setting to a value** - Update this field with a new value

#### Example: HTTP PATCH request semantics
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [vale] reported by reviewdog 🐶
[FernStyles.Acronyms] 'PATCH' has no definition.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 5, 2025

@devalog devalog closed this Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants