ClientSDK C# project

Continuing with our PetStore example, LazyStack generates the PetStoreClientSDK project containing:

  • PetStore.cs class -- generated by NSwag
  • MethodMap.json -- generated by LazyStack

The MethodMap.json file maps individual interface methods to ApiGateway(s). Here is an example of a generated MethodMap.json file.

    "MethodMap": {
        "AddPetAsync": "HttpApiSecure",
        "UpdatePetAsync": "HttpApiSecure",
        "FindPetsByStatusAsync": "HttpApiSecure",
        "GetPetByIdAsync": "HttpApiSecure",
        "UpdatePetWithFormAsync": "HttpApiSecure",
        "DeletePetAsync": "HttpApiSecure",
        "GetPetCategoriesAsync": "HttpApiSecure",
        "GetPetTagsAsync": "HttpApiSecure",
        "GetInventoryAsync": "ApiSecure",
        "PlaceOrderAsync": "HttpApiSecure",
        "GetOrderByIdAsync": "HttpApiSecure",
        "DeleteOrderAsync": "ApiSecure",
        "FindPetsByTagsAsync": "HttpApiSecure",
        "SeedPetsAsync": "HttpApiSecure"

Note:There are a variety of OpenApi → C# code generators available. Some of these offer substantially more features than the current version of NSwag. However, NSwag is native C#, very robust and under active development so we have chosen to use it.