Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the model classes partial in C# #4894

Closed
vvdb-architecture opened this issue Jun 26, 2024 · 2 comments · Fixed by #4895
Closed

Make the model classes partial in C# #4894

vvdb-architecture opened this issue Jun 26, 2024 · 2 comments · Fixed by #4895
Assignees
Labels
Csharp Pull requests that update .net code type:feature New experience request
Milestone

Comments

@vvdb-architecture
Copy link
Contributor

Is your feature request related to a problem? Please describe the problem.

In other code generators (did anyone say NSwag?) , the generated model classes are partial. This can be very handy to add some computed properties as part of the API, without forcing users to define wrapper classes.
It may not be applicable to other languages not having the partial class concept, but it surely would help those who use C#.

Client library/SDK language

Csharp

Describe the solution you'd like

generate public partial class instead of public class when generating model code.

Additional context

No response

@vvdb-architecture vvdb-architecture added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:feature New experience request labels Jun 26, 2024
@github-project-automation github-project-automation bot moved this to Needs Triage 🔍 in Kiota Jun 26, 2024
@msgraph-bot msgraph-bot bot added the Csharp Pull requests that update .net code label Jun 26, 2024
@baywet
Copy link
Member

baywet commented Jun 26, 2024

Hi @vvdb-architecture
Thanks for using kiota and for reaching out.
We've had multiple requests about that #4242 among others.
Although my personal opinion is that we shouldn't do this (unique to CSharp, does not provide much more value than extension methods), I think this is evidence the community wants it.

This gets written here

writer.WriteLine($"public class {codeElement.Name.ToFirstCharacterUpperCase()} {derivation}");

And tested there

Is this something you'd be willing to submit a pull request for?

@baywet baywet moved this from Needs Triage 🔍 to Todo 📃 in Kiota Jun 26, 2024
@baywet baywet added this to the Kiota v1.16 milestone Jun 26, 2024
@baywet baywet removed the status:waiting-for-triage An issue that is yet to be reviewed or assigned label Jun 26, 2024
vvdb-architecture added a commit to vvdb-architecture/kiota that referenced this issue Jun 26, 2024
@vvdb-architecture
Copy link
Contributor Author

Here you go @baywet: #4895.

That should be much easier than correcting #4893 which is just... strange.

@github-project-automation github-project-automation bot moved this from Todo 📃 to Done ✔️ in Kiota Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Csharp Pull requests that update .net code type:feature New experience request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants