swagger-api / swagger-api/swagger-codegen

[Bug]: the C# client library generator does not use the 'sourceFolder' option when generate the test project code.

Open
#12,751 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

The C# client library generator does not use the 'sourceFolder' option when generate the test project code.

Swagger Codegen Version

3.0.81

Language / Generator

csharp

OpenAPI/Swagger Spec

Content of the test.yaml file.

openapi: 3.0.0
info:
  version: "1.0.0"
  title: "Test"
paths:
  /status:
    get:
      operationId: getAssetStatus
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AssetStatus'
components:
  schemas:
    AssetStatus:
      type: object
      properties:
        live:
          type: boolean
      required:
        - live

Configuration file used

Content of the ConfigCodeGen.json file.

{
  "sourceFolder": "."
}

Command Line Used

java -jar swagger-codegen-cli.jar generate -l csharp -o code -c ConfigCodeGen.json -i test.yaml

Steps to Reproduce

  1. Run the generator using the command line specified and the indicated input files.

Expected Behavior

The generator should place the code of the test project in the folder specified through the configuration file as per the IO project.

Actual Behavior

The source code of the test project is place inside the 'src' folder regardless of the configuration.

Environment

  • OS: Windows 11;
  • Java Version: OpenJDK 26.0.1;
  • Build Tool: not builded by myself, I'm using the pre-build version;
  • Swagger Codegen CLI version: 3.0.81.

Checklist

  • I have searched the existing issues to make sure this is not a duplicate.
  • I have included a minimal and reproducible spec example.
  • I have explained how to reproduce the issue.
  • I have specified which generator/language is affected.

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 reproducing the command with test.yaml and ConfigCodeGen.json, then inspect how the C# generator chooses the output path for test project code versus the IO project. Done means the configured sourceFolder controls the test project source location instead of always placing it under src.

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
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.