RicoSuter / NSwag

The Swagger/OpenAPI toolchain for .NET, ASP.NET Core and TypeScript.
http://NSwag.org
MIT License
6.7k stars 1.23k forks source link

Liquid error in nswag Tool #1614

Open sankp opened 6 years ago

sankp commented 6 years ago

I downloaded tool v11.19.2.0 to upgrade angular 4 project to angular 6 project so i can regenerate my typescript client. I am running into this error on my base class creation. Liquid error: Exception has been thrown by the target of an invocation. Liquid error: Exception has been thrown by the target of an invocation.

image

RicoSuter commented 6 years ago

One of the backing model's properties seems to throw an exception. Can you provide a sample spec + config to reproduce this?

sankp commented 6 years ago

@RSuter Here i have added. "swaggerToTypeScriptClient": { "className": "{controller}ApiClient", "moduleName": "", "namespace": "", "typeScriptVersion": 2.7, "template": "Angular", "promiseType": "Promise", "httpClass": "HttpClient", "useSingletonProvider": true, "injectionTokenType": "InjectionToken", "rxJsVersion": 6.0, "dateTimeType": "Date", "nullValue": "Undefined", "generateClientClasses": true, "generateClientInterfaces": true, "generateOptionalParameters": false, "exportTypes": true, "wrapDtoExceptions": false, "clientBaseClass": null, "wrapResponses": false, "wrapResponseMethods": [], "generateResponseClasses": true, "responseClass": "SwaggerResponse", "protectedMethods": [], "configurationClass": null, "useTransformOptionsMethod": true, "useTransformResultMethod": true, "generateDtoTypes": true, "operationGenerationMode": "SingleClientFromOperationId", "markOptionalProperties": false, "generateCloneMethod": false, "typeStyle": "Class", "classTypes": [], "extendedClasses": [ "ApiClient" ], "extensionCode": null, "generateDefaultValues": true, "excludedTypeNames": [], "handleReferences": false, "generateConstructorInterface": true, "convertConstructorInterfaceData": false, "importRequiredTypes": true, "useGetBaseUrlMethod": false, "baseUrlTokenName": "API_BASE_URL", "queryNullValue": "", "templateDirectory": null, "typeNameGeneratorType": null, "propertyNameGeneratorType": null, "enumNameGeneratorType": null, "serviceHost": null, "serviceSchemes": null, "output": "" }

RicoSuter commented 5 years ago

Is this still an issue? Canyou also post a sample swagger spec?

vdurante commented 5 years ago

@RicoSuter I had the same issue here, with the following:

"/api/services/app/Configuration/ChangeLogo2":{  
         "post":{  
            "tags":[  
               "Configuration"
            ],
            "operationId":"ApiServicesAppConfigurationChangeLogo2Post",
            "consumes":[  
               "application/json-patch+json",
               "application/json",
               "text/json",
               "application/*+json"
            ],
            "produces":[  

            ],
            "parameters":[  
               {  
                  "name":"tenantId",
                  "in":"body",
                  "required":false,
                  "schema":{  
                     "format":"int32",
                     "type":"integer"
                  }
               },
               {  
                  "name":"image",
                  "in":"body",
                  "required":false,
                  "schema":{  
                     "type":"string"
                  }
               }
            ],
            "responses":{  
               "200":{  
                  "description":"Success"
               }
            }
         }
      },