Skip to content

Conversation

@jamietanna
Copy link
Member

No description provided.

Jamie Tanna added 3 commits May 11, 2025 16:36
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 jamietanna requested a review from a team as a code owner May 11, 2025 15:50
@jamietanna jamietanna merged commit c8cf342 into main May 11, 2025
36 checks passed
@jamietanna jamietanna deleted the defect/not-required branch May 11, 2025 16:04
@jamietanna jamietanna added the enhancement New feature or request label Jul 15, 2025
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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants