OpenAPITools / OpenAPITools/openapi-generator
When polymorphism is present, csharp code has an issue on positional parameters
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
CSharp client for framework netcoreapp2.0 version.
When polymorphism is present, such as MyJob extends Job, MyJob constructor calls base constructor
with not named arguments, when these arguments are not optional.
This issue occurs when a parameter is Enum type and so it's required, not optional
public partial class Job : IEquatable<Job>, IValidatableObject
{
public Job(long? jobId = default(long?), JobStatusEnum? jobStatus = default(JobStatusEnum?), string name = default(string))
{
...
}
}
public partial class MyJob : Job, IEquatable<MyJob>, IValidatableObject
{
public MyJob(...) : base(jobStatus)
}
Swagger-codegen version
swagger-codegen-cli-2.4.0-20181007.065826-339
Suggest a fix/enhancement
public partial class MyJob : Job, IEquatable<MyJob>, IValidatableObject
{
public MyJob(...) : base(jobStatus: jobStatus)
}
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
Reproduce the issue with a polymorphic model where the base constructor has a required enum parameter, then trace the C# generator's model-constructor emission. Compare the generated derived constructor's base call with the requested named-argument form; done means valid C# is generated for this case and the regression is covered by an appropriate generator test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, openapi
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100