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

Nswag clients with some endpoints excluded #5076

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

knoepdan
Copy link
Contributor

I added 2 new settings that allow some endpoints to be NOT generated.

Main benefits:

  • reduced size (especially for typescript)
  • reduced complexity (especially API is big but only needs a fraction of the endpoints)
  • helps with some workflows (depends on the workflows and companies, see comment below).

The first 2 benefits are relatively obvious but what this Pull-Request would help us the most are actually that we could facilitate some workflows.
a) When have a breaking change to an api we usually create a new version of the same endpoint and deprecate the old one. A few releases later we then remove the old api. However, when we remove the endpoint, NSWAG often changes some names of the new endpoint so the calling code has to be adapted as well. By always ignoring the deprecated endpoints, one could adjust the naming immediately and it not when we remove the endpoint (when it's less obvious).
b) sometimes we deliberately want an application to only use (or exclude) certain endpoints because of reasons like permissions / future plans for the api's etc. and it would help us to exclude some endpoints from the start to prevent new developers from unwanted endpoints by accident.

I hope this PR would also benefit a lot of other NSWAG users.
However, since I'm not too familiar with the project (from a contributor perspective), I will gladly make changes or accept feedback.

  • general idea + approach??
    
  • chosen naming ok?
    
  • I added the change specifically to OpenApiToCSharpClientCommand + OpenApiToTypeScriptClientCommand. I could move it up to the base class. Would that be ok or would you rather have it limited to Typescript (or for all TS, C# Client + C# Controller)
    
  • I was not sure where to place tests.... (for Typescript I added a new class)
    

Anyway, would be glad about feedback and even more so if I could contribute to NSWAG.

PS: I tried a pull request before but for some reason it was rejected due to an ubuntu issue. (which I'm pretty but sure.. about 99.9% this PR should not affect this)

@knoepdan
Copy link
Contributor Author

The ubuntu run seems to fail, but I believe it has more to do with the setup than with my changes.
How can I fix it? (even though I doubt it's in my power)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants