Skip to content

fix(schema): keep nullability for pointers to string-typed arrays - #1157

Merged
robtme merged 1 commit into
mainfrom
fix/pointer-array-nullable
Oct 28, 2026
Merged

robtme merged 1 commit into
mainfrom
fix/pointer-array-nullable

Conversation

@robtme

@robtme robtme commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

Pointers to arrays and slices were decayed to the element-less type before schema generation, so any array type rendered as a string lost its pointer nullability. That covers *uuid.UUID (stdlib), *net.IP, *[]byte and [N]byte TextUnmarshalers like google/uuid. schemaFromType already derefs, and real array schemas take nullability from DefaultArrayNullable, so the decay block is removed rather than special-cased.

  • Spec output changes for existing users: these fields become ["string", "null"]. Worth a release note.
  • Aliased pointer types still lose nullability (r.aliases[t] recurses on the deref'd type). That predates this change, so I left it alone.

Fixes #1155

Pointers to arrays and slices were decayed before schema generation, so
*uuid.UUID, *net.IP, *[]byte and *[N]byte TextUnmarshalers never came
out nullable. schemaFromType already derefs, so the decay is unneeded.

Fixes #1155
@codecov

codecov Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.72%. Comparing base (dcdadba) to head (9db6c0d).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1157      +/-   ##
==========================================
- Coverage   94.72%   94.72%   -0.01%     
==========================================
  Files          25       25              
  Lines        5195     5193       -2     
==========================================
- Hits         4921     4919       -2     
  Misses        269      269              
  Partials        5        5              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@robtme
robtme merged commit a2fa2a1 into main Oct 28, 2026
7 checks passed
@robtme
robtme deleted the fix/pointer-array-nullable branch October 28, 2026 16:38
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.

*uuid.UUID fields aren't marked nullable

1 participant