OpenAPITools / OpenAPITools/openapi-generator

[BUG] [CSharp] Use lowercase string.Join() instead of String.Join()

Open
#19,417 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Bug Report Checklist
  • [v] Have you provided a full/minimal spec to reproduce the issue?
  • [v] Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?

Not with master, but with the latest released version in npm.

  • [v] Have you searched for related issues/PRs?
  • [v] What's the actual output vs expected output?
Description

In CSharp code generation, there is a build error in generated code due to String.Join function being used with the UpperCase String which is conflicting with a custom String class defined in the generated code (bad practice, but it is out of my control, I didn't define the json schema, just generating code for it), this would not happen if string lowercase was used, since the class names start with UpperCase.

openapi-generator version

openapi-generator-cli version
Did set selected version to 7.8.0

Steps to reproduce
openapi-generator-cli generate -g csharp --skip-validate-spec  -i https://raw.githubusercontent.com/PagerDuty/api-schema/5d679f79622d30b767c777be5f2e9787ef21e092/reference/REST/openapiv3.json

In the code generated, if you search the project by "String.Join" with case sensitive search, it will show the invalid code references.

Suggest a fix

When generating code, use always
string.Join( with the lowercase s instead of String.Join( with the uppercase S.

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 running the provided openapi-generator-cli command with generator version 7.8.0, then search the generated C# project for case-sensitive "String.Join" references. Trace those references back to the generator source or templates. Done means generated C# uses lowercase "string.Join(" and no conflicting uppercase references remain.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.