Fix TanStack Query compatibility by adding support for returning null instead of undefined #1468
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.
Issue
This pull request aims to address an issue that arises when an endpoint returns a

204 No Content
status. Currently, the TanStack query generates an error stating that the Query data cannot be undefined, as demonstrated in the following screenshot:Solution
To resolve this issue, the proposed solution involves allowing the return of null values instead of undefined by introducing an optional parameter. This change will enable the library to handle
204 No Content
responses more gracefully and prevent errors in such scenarios.Changes
This pull request includes the following changes to the codebase:
Added --useNullForNoContent flag in the README, documentation, and command-line options
Added useNullForNoContent to the Options type, the generate function, and related utility functions
Updated test cases to include the --useNullForNoContent flag
Modified the getResponseBody template for one of the core clients (applies to all) to conditionally return null or undefined based on the useNullForNoContent flag
These changes allow the library to support "204 No Content" responses by returning null instead of undefined when the --useNullForNoContent flag is set.
Notes/things to review
useNullForNoContent
option / variable name.