swagger-api / swagger-api/swagger-codegen
[CSHARP] 3.x array schema doesnt work - always is Object
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
Array types always translated to "Object", even if nested inside an actual object schema.
DefaultApi.cs, supposed to return an array of strings.
Object GetArray ();
Test2.cs, arr is an array of strings.
/// <summary>
/// Gets or Sets Arr
/// </summary>
[DataMember(Name="arr", EmitDefaultValue=false)]
public Object Arr { get; set; }
Swagger-codegen version
3.0.36
Swagger declaration file content or url
https://gist.github.com/ShoryuKyzan/02bfa48e1b82ca937150467644da56c3
Command line used for generation
java -jar swagger-codegen-cli-3.0.36.jar generate \
-i swagger.json \
-l csharp \
-o api-gen
openjdk 19.0.1 2022-10-18
OpenJDK Runtime Environment (build 19.0.1+10-21)
OpenJDK 64-Bit Server VM (build 19.0.1+10-21, mixed mode, sharing)
Windows 10
Steps to reproduce
Run the above commands
Related issues/PRs
N/A
Suggest a fix/enhancement
?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the supplied swagger-codegen 3.0.36 command against the linked Swagger declaration and inspect the generated DefaultApi.cs and Test2.cs. Trace how the array schemas become Object; done means the generated method and property use an appropriate string-array type, with a regression test covering both cases.
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
- 38/100