Skip to content

fix(generator): nullable inline object schema crashes on nil value#3976

Merged
MintsInc merged 1 commit intomasterfrom
fix/nullable-inline-object-nil-crash
Apr 17, 2026
Merged

fix(generator): nullable inline object schema crashes on nil value#3976
MintsInc merged 1 commit intomasterfrom
fix/nullable-inline-object-nil-crash

Conversation

@MintsInc
Copy link
Copy Markdown
Member

@MintsInc MintsInc commented Apr 17, 2026

Summary

  • reference_to_value raised NotImplementedError when a BDD scenario sent null for a nullable field whose schema is an inline object (no $ref)
  • The guard was a placeholder from the initial implementation (April 2022, commit 5172f6dc6) — it was never deliberately designed, just never hit until now
  • Fix: when value == "nil" and no named type is available, return "nil" directly — there is nothing to wrap
  • The NotImplementedError for the non-nil anonymous case is preserved (genuinely unsupported, and unreachable for type: object in practice)

Test plan

  • poetry run pytest tests/test_formatter.py -v — 7 tests pass (5 existing + 2 new)
  • Two new tests cover data=None with {type: object, nullable: true} and with additionalProperties: {}

🤖 Generated with Claude Code

Run the generator with those changes and I confirmed there were no changes

When a BDD scenario sends null for a nullable field whose schema is an
inline object (no \$ref), reference_to_value raised NotImplementedError
because it tried to look up a NewNullableXxx function that doesn't exist
for anonymous types. Since nil doesn't need wrapping, return it directly.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@MintsInc MintsInc marked this pull request as ready for review April 17, 2026 12:19
@MintsInc MintsInc requested review from a team as code owners April 17, 2026 12:19
@MintsInc MintsInc added the changelog/no-changelog Changes don't appear in changelog label Apr 17, 2026
@MintsInc MintsInc merged commit 2dafb57 into master Apr 17, 2026
17 of 18 checks passed
@MintsInc MintsInc deleted the fix/nullable-inline-object-nil-crash branch April 17, 2026 13:20
github-actions Bot pushed a commit that referenced this pull request Apr 17, 2026
…3976)

When a BDD scenario sends null for a nullable field whose schema is an
inline object (no \$ref), reference_to_value raised NotImplementedError
because it tried to look up a NewNullableXxx function that doesn't exist
for anonymous types. Since nil doesn't need wrapping, return it directly.

Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> 2dafb57
github-actions Bot pushed a commit to ConnectionMaster/datadog-api-client-go that referenced this pull request Apr 17, 2026
…ataDog#3976)

When a BDD scenario sends null for a nullable field whose schema is an
inline object (no \$ref), reference_to_value raised NotImplementedError
because it tried to look up a NewNullableXxx function that doesn't exist
for anonymous types. Since nil doesn't need wrapping, return it directly.

Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> 2dafb57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/no-changelog Changes don't appear in changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants