Repository navigation
fix(schema): keep nullability for pointers to string-typed arrays - #1157
Merged
Merged
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
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.
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,*[]byteand[N]byteTextUnmarshalers like google/uuid.schemaFromTypealready derefs, and real array schemas take nullability fromDefaultArrayNullable, so the decay block is removed rather than special-cased.["string", "null"]. Worth a release note.r.aliases[t]recurses on the deref'd type). That predates this change, so I left it alone.Fixes #1155