swagger-api / swagger-api/swagger-codegen
When polymorphism is present, csharp code has an issue on positional parameters
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
CSharp client for framework 5.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
Locate the C# code-generation template or entry point that emits constructors for polymorphic models, then compare the generated derived constructor with the reported Job/MyJob example. Verify that required enum parameters are handled correctly in the base-constructor call and that the generated C# compiles for this case.
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
- 35/100