swagger-api / swagger-api/swagger-codegen
[CSharp] Codegen method return type nullable
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
it is pretty annoying to make every member [required] but ok.
How to define that return type is not nullable?
Im using Swashbuckle 5.6.0
bool HasUser(string Username) //server side
bool? HasUser(string Username) // client side
What i need is something like
[required]bool HasUser(string Username) // server
I try to inject some required and x-nullable just if it work but it not.
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "boolean",
"x-type-dotnet": "System.Boolean",
"x-nullable": false,
"required": true
},
"x-null": false,
"required": true,
"x-type-dotnet": "System.Boolean",
"x-nullable": false
}
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the generated C# client from the Swashbuckle 5.6.0 schema shown in the issue and inspect how the response schema's nullable metadata is interpreted. Done means the generated HasUser method returns bool rather than bool? without requiring unsupported schema changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100