-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
NSwag Configuration Document
Rico Suter edited this page Feb 12, 2018
·
17 revisions
An .nswag configuration document describes one Swagger generator/reader (input), and multiple client code generators (outputs). This configuration can be easily created and executed with NSwagStudio.
The available settings of the input and outputs are the same as the command line commands. Only generators where the "output" setting is set (i.e. code output path) are actually executed...
TODO: Document variables/placeholders: https://github.com/RSuter/NSwag/issues/1159#issuecomment-364882574
{
"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
}
}
}