-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
NSwag Configuration Document
Rico Suter edited this page Jun 18, 2017
·
17 revisions
A .nswag configuration document describes one Swagger generator/reader (input), and multiple client code generators (outputs):
{
"swaggerGenerator": {
"webApiToSwagger": {
"assemblyPaths": [],
"referencePaths": [],
"isAspNetCore": false,
"controllerNames": [],
"defaultUrlTemplate": "api/{controller}/{id?}",
"defaultPropertyNameHandling": "Default",
"defaultEnumHandling": "Integer",
"flattenInheritanceHierarchy": false,
"generateKnownTypes": true,
"generateXmlObjects": false,
"addMissingPathParameters": false,
"infoTitle": "Web API Swagger specification",
"infoVersion": "1.0.0",
"output": null
}
},
"codeGenerators": {
"swaggerToTypeScriptClient": {
"className": "{controller}Client",
"moduleName": "",
"namespace": "",
"typeScriptVersion": 1.8,
"template": "Angular",
"promiseType": "Promise",
"dateTimeType": "Date",
"nullValue": "Undefined",
"generateClientClasses": true,
"generateClientInterfaces": false,
"generateOptionalParameters": false,
"wrapDtoExceptions": false,
"useTransformOptionsMethod": false,
"useTransformResultMethod": false,
"generateDtoTypes": true,
"operationGenerationMode": "MultipleClientsFromOperationId",
"markOptionalProperties": true,
"generateCloneMethod": false,
"typeStyle": "Class",
"generateDefaultValues": true,
"excludedTypeNames": [],
"handleReferences": false,
"generateConstructorInterface": true,
"importRequiredTypes": true,
"baseUrlTokenName": "API_BASE_URL",
"output": null
},
"swaggerToCSharpClient": {
"generateClientClasses": true,
"generateClientInterfaces": false,
"generateDtoTypes": true,
"injectHttpClient": false,
"disposeHttpClient": true,
"generateExceptionClasses": true,
"exceptionClass": "SwaggerException",
"wrapDtoExceptions": true,
"useHttpClientCreationMethod": false,
"httpClientType": "System.Net.Http.HttpClient",
"useHttpRequestMessageCreationMethod": false,
"useBaseUrl": true,
"generateSyncMethods": false,
"clientClassAccessModifier": "public",
"generateContractsOutput": false,
"className": "{controller}Client",
"namespace": "MyNamespace",
"generateOptionalParameters": false,
"requiredPropertiesMustBeDefined": true,
"dateType": "System.DateTime",
"dateTimeType": "System.DateTime",
"timeType": "System.TimeSpan",
"timeSpanType": "System.TimeSpan",
"arrayType": "System.Collections.ObjectModel.ObservableCollection",
"dictionaryType": "System.Collections.Generic.Dictionary",
"classStyle": "Inpc",
"operationGenerationMode": "MultipleClientsFromOperationId",
"generateDefaultValues": true,
"generateDataAnnotations": true,
"excludedTypeNames": [],
"wrapResponses": false,
"generateResponseClasses": true,
"responseClass": "SwaggerResponse",
"handleReferences": false,
"generateImmutableArrayProperties": false,
"generateImmutableDictionaryProperties": false,
"output": null
}
}
}```
The available settings of the input and outputs are the same as the [[command line commands|CommandLine]]. Only outputs where the "output" setting is set (i.e. code output path) are actually executed...