NSwag
NSwag copied to clipboard
"Nested" C# clients generation mode
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.