Skip to content

fix: preserve nullability in Literal descriptions - #318

Merged
allmonday merged 3 commits into
KLR-Pattern:masterfrom
theman6660:fix/literal-description-nullability
Oct 6, 2026
Merged

allmonday merged 3 commits into
KLR-Pattern:masterfrom
theman6660:fix/literal-description-nullability

Conversation

@theman6660

Copy link
Copy Markdown
Contributor

Fixes #315

Literal descriptions currently render Boolean values as Python True/False and omit legal null values. Clients relying on the schema description can consequently construct invalid GraphQL input or incorrectly reject null.

  • Render Boolean members as true/false, preserving string and numeric members.
  • Preserve nullability from Literal members and Optional/union wrappers when constructing descriptions, including through existing list unwrapping.
  • Keep literal_allowed_values' public return contract unchanged.
  • Cover helper behavior, entity introspection, and compose argument/input/output descriptions.

The helpers now live in graphql/type_mapping.py and are shared by both schema paths, so the fix is made there rather than in compose_schema.py.

Validation (Python 3.12.14):

  • New/updated regression checks before the fix: 8 failed, 30 passed.
  • python -m pytest tests/graphql tests/use_case -q: 424 passed, 2 skipped.
  • git diff --check: passed.

AI-assisted implementation. No claim of validation on other Python versions or of running the repository-wide suite.

@allmonday

Copy link
Copy Markdown
Collaborator

thanks for your contributation

@allmonday
allmonday merged commit 41f90c2 into KLR-Pattern:master Oct 6, 2026
allmonday added a commit that referenced this pull request Oct 6, 2026
Literal description accuracy and nullability consistency release:
Allowed values descriptions render GraphQL literals and advertise
null (#318), and SDL nullability aligns with introspection (#320,
#321 — nullable output fields lose the ! suffix).

Co-Authored-By: Claude Code <noreply@anthropic.com>
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.

compose: Literal descriptions render booleans as True/False and omit null for nullable literals

2 participants