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

Class access modifiers #4788

Closed
NKnusperer opened this issue Jun 5, 2024 · 5 comments · Fixed by #5284
Closed

Class access modifiers #4788

NKnusperer opened this issue Jun 5, 2024 · 5 comments · Fixed by #5284
Assignees
Labels
type:feature New experience request WIP
Milestone

Comments

@NKnusperer
Copy link
Contributor

NKnusperer commented Jun 5, 2024

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

Currently, all classes generated by Kiota have the public access modifier, which means they are visible to all other projects that reference them. However, the generated SDK code may just be an implementation detail that should not be exposed, so it would be appropriate to have the internal access modifier instead.

Client library/SDK language

Csharp

Describe the solution you'd like

A command line argument for kiota generate that controls the class access modifier, similar to what --class-name already does.

Additional context

No response

@NKnusperer NKnusperer added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:feature New experience request labels Jun 5, 2024
@andrueastman
Copy link
Member

Thanks for raising this @NKnusperer

In a scenario where the generated SDK project is being referenced from another project, would you need at least the ApiClient to be public? What about the models needed to send over as payloads?

@andrueastman andrueastman added needs more information status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close and removed status:waiting-for-triage An issue that is yet to be reviewed or assigned labels Jun 6, 2024
@NKnusperer
Copy link
Contributor Author

Hello @andrueastman,
the scenario is where the ApiClient is an implementation detail abstracted by an application specific API.
Lets say we are building a karaoke application, so we need access to songs, album covers, lyrics etc.
After designing an interface for each service, we implement it for, say, Spotify, Amazon Music, and Apple MusicKit.
Now nobody cares about the ApiClient except the implementations, so it could be internal.

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Attention 👋 and removed status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close labels Jun 6, 2024
@baywet
Copy link
Member

baywet commented Jun 11, 2024

This is an interesting suggestion. We already have the mechanics to convey accessibility with the access modifier enum, it's simply not implemented for class/enum/interface declarations where it's currently hard coded

But adding this information to the DOM, using it to emit the right modifier, and setting the value from an optional CLI parameter should be trivial.

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

@baywet baywet added status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close and removed Needs: Attention 👋 labels Jun 11, 2024
@NKnusperer
Copy link
Contributor Author

Thank you @baywet, I will definitely take a look at this 👍

@haverjes
Copy link

I was looking for the exact same feature is there any estimate on if or when this might be available?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New experience request WIP
Projects
Status: Done ✔️
Development

Successfully merging a pull request may close this issue.

4 participants