Set SkipOptionalPointer for array types#388
Closed
natsukagami wants to merge 1 commit intooapi-codegen:masterfrom
Closed
Set SkipOptionalPointer for array types#388natsukagami wants to merge 1 commit intooapi-codegen:masterfrom
natsukagami wants to merge 1 commit intooapi-codegen:masterfrom
Conversation
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.
Brief Description of Changes
Set the
SkipOptionalPointerproperty totruefor all array schema types.Effectively, this means an optional
[]intstill has type[]int, instead of the old*[]int.Rationale
I don't find any functional difference in treating an
[]intand an*[]int. See:[]intversion)*[]intversion)They both:
nilvalue) and empty array case (where both are non-nil).NULLvalue.On the other hand,
*[]Tare much more clumsy to work with, due to the additional referencing/dereferencingrequired.
Some libraries that rely on the polymorphic behaviour of
len(on arrays and maps) cannot be used,forcing the user to check for
niland dereferencing the*[]Tas input.ozzo-validaion'sLengthcheck is one of them.Breaking Change
Yes, this is a breaking change (it functionally changes some test examples).
However, I believe this makes the user experience much better.