OpenAPITools / OpenAPITools/openapi-generator

[csharp-netcore] optionalMethodArgument seems not work in csharp*

Open
#5,789 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Description

Hi,
I'm trying to generate a Csharp-netcore client and integrate it with my application.
I'm struggling integrating it with Automapper because of the default parameters.
I read the documentation and saw that there is an option for excluding them "optionalMethodArgument" but regardless of the value I use in the config I always obtain the same result.

openapi-generator version

4.3.0

Command line used for generation

java -jar .\openapi-generator-cli.jar generate -i .\checkoutrestriction.yaml -g csharp-netcore -o solution -c .\config.json

{
"targetFramework":"netstandard2.0",
"optionalMethodArgument":"false",
"validatable":"false",
"netCoreProjectFile":"true"
}
Steps to reproduce

Execute the previous command with optionalMethodArgument set to false over a spec that has required fields.

Suggest a fix/enhancement

I don't know if this is either a bug or an implementation decision, that's what I was trying to find out. Fix/enhancement would be to add this verification to the mustache template I guess.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by generating the C# client with checkoutrestriction.yaml and config.json, comparing the output when optionalMethodArgument is set to false. Trace where that option is consumed for the csharp-netcore generator and verify whether required fields are expected to produce optional method arguments. Done means the option's behavior is corrected or clearly established with a reproducible result.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.