NSwag icon indicating copy to clipboard operation
NSwag copied to clipboard

"Nested" C# clients generation mode

Open Pilchard123 opened this issue 2 years ago • 0 comments

Could it be possible to generate a client that has other clients as properties of that client? I'm thinking of something like Octokit, which has one parent GitHubClient with properties like Issues and Organisation, each of which is itself a client for a section of the API. The parent client has no API-calling methods itself, though I think in the case of Octokit that's because there are no

To use the pet store sample and splitting clients by path segment, there would likely be a root PetStoreClient with properties Pet, Store, and User.

The Pet property would be a PetClient, with methods UploadImageAsync, FindByStatus, FindByTags, etc. Store and User would be similar.

I'm just thinking aloud here, really. It would mean that there is a single obvious entry point for a set of clients, but I don't know if this would be better done by the user of the currently-generated code writing a wrapper around what already exists.

Pilchard123 avatar Sep 07 '22 16:09 Pilchard123