You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
When using the OpenAPI Generator CLI (version 7.10.0) to generate a C# client with the nullableReferenceTypes=true option, methods returning a nullable schema do not generate nullable response types (e.g., Task<MyType?>).
In my C:\Temp folder I have only Example.yaml and config.yaml files. I'm running next command to generate api in Console: openapi-generator-cli generate -c config.yaml
As a result I have C:\Temp\output-directory\src\Org.OpenAPITools\Api\DefaultApi.cs with next code: public async System.Threading.Tasks.Task<MyType> ExamplePostAsync(...
You can find it in attachment DefaultApi.cs.txt.
However, I expected to have public async System.Threading.Tasks.Task<MyType?> ExamplePostAsync(...
Related issues/PRs
Suggest a fix
Ensure that the C# generator respects the nullableReferenceTypes=true configuration and generates nullable response types (Task<MyType?>) for schemas defined as nullable: true or oneOf with null.
The text was updated successfully, but these errors were encountered:
Bug Report Checklist
Description
When using the OpenAPI Generator CLI (version 7.10.0) to generate a C# client with the nullableReferenceTypes=true option, methods returning a nullable schema do not generate nullable response types (e.g., Task<MyType?>).
openapi-generator version
7.10.0
OpenAPI declaration file content or url
Example.yaml or Example2.yaml
Generation Details
My Environment:
I installed openapi-generator-cli via:
npm install -g @openapitools/openapi-generator-cli
Configuration file:
config.yaml
Steps to reproduce
In my C:\Temp folder I have only Example.yaml and config.yaml files. I'm running next command to generate api in Console:
openapi-generator-cli generate -c config.yaml
As a result I have C:\Temp\output-directory\src\Org.OpenAPITools\Api\DefaultApi.cs with next code:
public async System.Threading.Tasks.Task<MyType> ExamplePostAsync(...
You can find it in attachment DefaultApi.cs.txt.
However, I expected to have
public async System.Threading.Tasks.Task<MyType?> ExamplePostAsync(...
Related issues/PRs
Suggest a fix
Ensure that the C# generator respects the nullableReferenceTypes=true configuration and generates nullable response types (Task<MyType?>) for schemas defined as nullable: true or oneOf with null.
The text was updated successfully, but these errors were encountered: