swagger-api / swagger-api/swagger-codegen

Generated .net v3.5 client fails to compile with error "Default parameter specifiers are not permitted"

Open
#6,485 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

I tried to generate csharp .net v3.5 client for the default .net core webapi template and it fails to compile.

I get multiple errors like following when trying to compile a client.

src\IO.Swagger\Client\Configuration.cs(133,29): error CS0241: Default parameter specifiers are not permitted
Swagger-codegen version

cloned with this commit https://github.com/swagger-api/swagger-codegen/commit/8067612e06172942c5d661f0988bb866492d1cab

Swagger declaration file content or url

https://gist.github.com/PoisonousJohn/41da6885eac2a2cbfc60304faf7ab88b

Command line used for generation
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
>    -i http://localhost:5000/swagger/v1/swagger.json \
>    -l csharp -DtargetFramework=v3.5 \
>    -o ~/projects/csharpApiClient
Steps to reproduce
  1. launch swagger generation
  2. run ./build.bat to build a client dll
  3. notice errors
Related issues/PRs
Suggest a fix/enhancement

remove default values from method parameters in favor of overloads without additional arguments

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 with the generated Client/Configuration.cs at the reported line and reproduce the failure using the Java generation command with -l csharp and -DtargetFramework=v3.5. Run ./build.bat and inspect the generated method parameters; done means the generated client compiles without CS0241 errors for the provided Swagger declaration.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.