OpenAPITools / OpenAPITools/openapi-generator

[BUG] [CSharp] Api methods generates without variable name

Open
#19,502 5 comments 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
  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

Hello, so I've updated from 7.0.1 to 7.8.0 and weirdly the constructor variables are without name...
I was expecting it not to change anything aside from the methods I joined in a previous PR.
I've tested the versions and with started happening from 7.5.0 upwards.

imagem

openapi-generator version

7.8.0

OpenAPI declaration file content or url

Here the Yaml I'm using.
https://gist.github.com/filipe-silva/bfe824f2a6b2ea170cd29ea4c326ab4d

Generation Details
Steps to reproduce

Simply generate the code using the terminal:
npx @openapitools/openapi-generator-cli generate -c openapi-dotnet.yaml

openapi-dotnet.yaml content:

{
  "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
  "spaces": 2,
  "generator-cli": {
    "version": "7.8.0"
  }
}
Suggest a fix

Couldn't figure out what was the breaking change, if someone can point me in the right direction I'll fix it.

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 openapi-dotnet.yaml configuration and the linked OpenAPI declaration, then run the supplied npx @openapitools/openapi-generator-cli generate command using version 7.8.0. Compare the generated C# API methods with output from 7.0.1 and identify the change introduced in 7.5.0 or later. Done means generated methods contain the expected variable names without regressing the reported constructor behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.