-
-
Notifications
You must be signed in to change notification settings - Fork 1k
feat(templates): consolidate logic for whether to use an optional pointer #1981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
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
As a means to consolidate our logic for whether a type has an optional pointer in templates, we can introduce a new helper method, `HasOptionalPointer`, which will indicate whether a given type - in a template - should have an "optional pointer" to indicate whether the field is optional. This wires it in for both properties (of structs) or parameter definitions. To start with, we will derive this based on whether it is required, and will add support for the `x-go-type-skip-optional-pointer` extension afterwards.
…ionalPointer` As a follow-up to introducing `HasOptionalPointer`, we can then reduce duplication around checking for the `x-go-type-skip-optional-pointer`, to allow more general control over the generation. This doesn't impact any of our existing generated code, as it doesn't utilise `x-go-type-skip-optional-pointer`.
As it's unclear form the name what it is.
jamietanna
added a commit
that referenced
this pull request
Nov 1, 2025
As part of #2031, we need to correct a subtle breakage in #1981, where we would not correctly perform the nil check on arrays, breaking marshalling functionality. As a first step, we add a new helper method to inform as to whether the zero value of a Property could be `nil`, and therefore needs a `nil` check.
jamietanna
added a commit
that referenced
this pull request
Nov 1, 2025
As part of #2031, we need to correct a subtle breakage in #1981, where we would not correctly perform the nil check on arrays, breaking marshalling functionality. As a first step, we add a new helper method to be used to validate whether a `nil` check is required on a given type, which is used for either types with a zero value of `nil`, or where we have an optional pointer set.
jamietanna
added a commit
that referenced
this pull request
Nov 1, 2025
As part of #2031, we need to correct a subtle breakage in #1981, where we would not correctly perform the nil check on arrays, breaking marshalling functionality. To do this we can modify our templates to call the newly added `RequiresNilCheck` when performing nil checks Closes #2031. Co-authored-by: Matthew Gabeler-Lee <[email protected]>
jamietanna
added a commit
that referenced
this pull request
Nov 1, 2025
As part of #2031, we need to correct a subtle breakage in #1981, where we would not correctly perform the nil check on arrays, breaking marshalling functionality. As a first step, we add a new helper method to inform as to whether the zero value of a Property could be `nil`, and therefore needs a `nil` check.
jamietanna
added a commit
that referenced
this pull request
Nov 1, 2025
As part of #2031, we need to correct a subtle breakage in #1981, where we would not correctly perform the nil check on arrays, breaking marshalling functionality. As a first step, we add a new helper method to be used to validate whether a `nil` check is required on a given type, which is used for either types with a zero value of `nil`, or where we have an optional pointer set.
jamietanna
added a commit
that referenced
this pull request
Nov 1, 2025
As part of #2031, we need to correct a subtle breakage in #1981, where we would not correctly perform the nil check on arrays, breaking marshalling functionality. To do this we can modify our templates to call the newly added `RequiresNilCheck` when performing nil checks Closes #2031. Co-authored-by: Matthew Gabeler-Lee <[email protected]>
jamietanna
added a commit
that referenced
this pull request
Nov 1, 2025
As part of #2031, we need to correct a subtle breakage in #1981, where we would not correctly perform the nil check on arrays, breaking marshalling functionality. As a first step, we add a new helper method to inform as to whether the zero value of a Property could be `nil`, and therefore needs a `nil` check.
jamietanna
added a commit
that referenced
this pull request
Nov 1, 2025
As part of #2031, we need to correct a subtle breakage in #1981, where we would not correctly perform the nil check on arrays, breaking marshalling functionality. As a first step, we add a new helper method to be used to validate whether a `nil` check is required on a given type, which is used for either types with a zero value of `nil`, or where we have an optional pointer set.
jamietanna
added a commit
that referenced
this pull request
Nov 1, 2025
As part of #2031, we need to correct a subtle breakage in #1981, where we would not correctly perform the nil check on arrays, breaking marshalling functionality. To do this we can modify our templates to call the newly added `RequiresNilCheck` when performing nil checks Closes #2031. Co-authored-by: Matthew Gabeler-Lee <[email protected]>
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.
No description provided.