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

Allow endpoints to be excluded by path and/or by deprecated #5075

Closed

Conversation

knoepdan
Copy link
Contributor

I added 2 new settings that allow some endpoints to be NOT generated.
Benefits and reasons for this PR:

  • The generated code can get quite big. Especially when your application only uses few endpoints of a big api then this can reduce the size considerable.
    -- this is probably more relevant for typescript but since it is easy to do the same for C# I added it too.
  • Deprecated endpoints are not allowed.
    -- For example, in my company, we may not use deprecated api's and by ignoring such endpoints we already get a compile error stream lines the work flows.
    -- This would also help us with a very specific problems that we sometimes have, when we deprecate a new endpoint, we usually have to create a new version. After many releases, we can then finally remove the deprecated endpoint. Unfortunately, we often have to adapt client code as well because the names of the remaining endpoints changes (due to some NSWAG counter). This is actually quite a big nuisance. With this change, we could mitigate this problem as the same person that deprecates the code would be able to adjust the calling code as well.

While I'm sure my PR works, I doubt that this change will end up like this in NSWAG. I just found this might be the best way to have this discussed. Some questions from my side:

  • general approach?? Would you want to have such a functionality ?
  • 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 now I just added them to C#

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

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