Draft
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@pothos/core
@pothos/plugin-add-graphql
@pothos/plugin-complexity
@pothos/plugin-dataloader
@pothos/plugin-directives
@pothos/plugin-drizzle
@pothos/plugin-errors
@pothos/plugin-example
@pothos/plugin-federation
@pothos/plugin-grafast
@pothos/plugin-mocks
@pothos/plugin-prisma
@pothos/plugin-prisma-utils
@pothos/plugin-relay
@pothos/plugin-scope-auth
@pothos/plugin-semantic-nullability
@pothos/plugin-simple-objects
@pothos/plugin-smart-subscriptions
@pothos/plugin-sub-graph
@pothos/plugin-tracing
@pothos/plugin-validation
@pothos/plugin-with-input
@pothos/plugin-zod
@pothos/tracing-newrelic
@pothos/tracing-opentelemetry
@pothos/tracing-sentry
@pothos/tracing-xray
commit: |
5dad7f7 to
cec32ea
Compare
Plugin that converts non-null fields to nullable with @semanticNonNull directives. Supports per-field opt-in via `semanticNonNull: true` and schema-wide conversion via `allNonNullFields: true` with per-field opt-out. Correctly computes `levels` for nested list types. https://claude.ai/code/session_01MLrx31yBgXYrx1LEzfPs2e
cec32ea to
f13b088
Compare
- `true` now only converts level 0 (the field itself), not all levels - Accept `number[]` to specify explicit levels (e.g. `[0, 1]`) - Only convert levels that are actually non-null (skip already-nullable) - Nullable fields with `semanticNonNull: true` are correctly ignored https://claude.ai/code/session_01MLrx31yBgXYrx1LEzfPs2e
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new
@pothos/plugin-semantic-nullabilityplugin that converts non-null fields to nullable with@semanticNonNulldirectives, for use with clients that support semantic nullability (Relay 18+, Apollo Kotlin, etc.).Plugin API
Per-field opt-in:
Schema-wide default with per-field opt-out:
List
levelssupport: automatically computes the correctlevelsargument for nested list types (e.g.,[String!]!→[String] @semanticNonNull(levels: [0, 1])).How it works
The plugin uses
onOutputFieldConfigto intercept non-null fields, flip them to nullable, and attach the@semanticNonNulldirective to extensions. The directive definition is registered on the schema viaafterBuild. TypeScript types are unchanged — the resolver contract remains non-null.Test plan
semanticNonNullstay as strict non-nulllevelscomputedallNonNullFieldsconverts all non-null fieldssemanticNonNull: falseoverrides schema-wide default@semanticNonNulldirective definition registered on schemahttps://claude.ai/code/session_01MLrx31yBgXYrx1LEzfPs2e