You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have POST endpoints in REST API project that return null response when 200 status code. Recently when we regenerated clients using v14.7.0 version of NSwag.MSBuild, we see that it has added additional null checks on response object because of which our tests now failing.
Is there a way to configure to not generate this new null checks for specific (or all) endpoints in latest version of NSwag.MSBuild? Here is the document generation part of my NSwag.json. "defaultResponseReferenceTypeNullHandling": "Null" already (found in another forum)
"runtime": "Net80",
"defaultVariables": "Configuration=Release,OutDir=bin/Release/net8.0/,HomeDir=%USERPROFILE%",
"documentGenerator": {
"aspNetCoreToOpenApi": {
"project": "APIProj.AppServices.csproj",
"controllerNames": [],
"isAspNetCore": true,
"resolveJsonOptions": false,
"defaultUrlTemplate": "api/{controller}/{id?}",
"addMissingPathParameters": false,
"includedVersions": null,
"defaultPropertyNameHandling": "CamelCase",
"defaultReferenceTypeNullHandling": "Null",
"defaultDictionaryValueReferenceTypeNullHandling": "NotNull",
"defaultResponseReferenceTypeNullHandling": "Null",
"defaultEnumHandling": "Integer",
"flattenInheritanceHierarchy": false,
"generateKnownTypes": true,
"generateEnumMappingDescription": false,
"generateXmlObjects": false,
"generateAbstractProperties": false,
"generateAbstractSchemas": true,
"ignoreObsoleteProperties": false,
"allowReferencesWithProperties": false,
"excludedTypeNames": [],
"serviceHost": null,
"serviceBasePath": null,
"serviceSchemes": [],
"infoTitle": "My Title",
"infoDescription": null,
"infoVersion": "1.0.0",
"documentTemplate": null,
"documentProcessorTypes": [],
"operationProcessorTypes": [],
"typeNameGeneratorType": null,
"schemaNameGeneratorType": null,
"contractResolverType": null,
"serializerSettingsType": null,
"useDocumentProvider": true,
"documentName": "v1",
"aspNetCoreEnvironment": null,
"createWebHostBuilderMethod": null,
"startupType": null,
"allowNullableBodyParameters": true,
"output": null,
"outputType": "Swagger2",
"newLineBehavior": "Auto",
"assemblyPaths": [],
"assemblyConfig": null,
"referencePaths": [
"$(HomeDir)/.nuget/packages"
],
"validateEnums": false,
"generateEnums": false,
"msBuildProjectExtensionsPath": null,
"configuration": "$(Configuration)",
"runtime": null,
"targetFramework": null,
"noBuild": true,
"msBuildOutputPath": null,
"verbose": true,
"workingDirectory": null,
"requireParametersWithoutDefault": false,
"apiGroupNames": null,
"useNuGetCache": false
}
},
Is there any other parameter to set?
I have checked the RicoSuter/NSwagPublic discussuin forum for the answer but could not get any.
The text was updated successfully, but these errors were encountered:
metalic-skeleton
changed the title
Squash null check in response object in latest version of NSwagStudio 14.7.0
Squash null check in response object in latest version of NSwag.MSBuild 14.7.0
Aug 19, 2024
We have POST endpoints in REST API project that return null response when 200 status code. Recently when we regenerated clients using v14.7.0 version of NSwag.MSBuild, we see that it has added additional null checks on response object because of which our tests now failing.
Is there a way to configure to not generate this new null checks for specific (or all) endpoints in latest version of NSwag.MSBuild? Here is the document generation part of my NSwag.json. "defaultResponseReferenceTypeNullHandling": "Null" already (found in another forum)
"runtime": "Net80",
"defaultVariables": "Configuration=Release,OutDir=bin/Release/net8.0/,HomeDir=%USERPROFILE%",
"documentGenerator": {
"aspNetCoreToOpenApi": {
"project": "APIProj.AppServices.csproj",
"controllerNames": [],
"isAspNetCore": true,
"resolveJsonOptions": false,
"defaultUrlTemplate": "api/{controller}/{id?}",
"addMissingPathParameters": false,
"includedVersions": null,
"defaultPropertyNameHandling": "CamelCase",
"defaultReferenceTypeNullHandling": "Null",
"defaultDictionaryValueReferenceTypeNullHandling": "NotNull",
"defaultResponseReferenceTypeNullHandling": "Null",
"defaultEnumHandling": "Integer",
"flattenInheritanceHierarchy": false,
"generateKnownTypes": true,
"generateEnumMappingDescription": false,
"generateXmlObjects": false,
"generateAbstractProperties": false,
"generateAbstractSchemas": true,
"ignoreObsoleteProperties": false,
"allowReferencesWithProperties": false,
"excludedTypeNames": [],
"serviceHost": null,
"serviceBasePath": null,
"serviceSchemes": [],
"infoTitle": "My Title",
"infoDescription": null,
"infoVersion": "1.0.0",
"documentTemplate": null,
"documentProcessorTypes": [],
"operationProcessorTypes": [],
"typeNameGeneratorType": null,
"schemaNameGeneratorType": null,
"contractResolverType": null,
"serializerSettingsType": null,
"useDocumentProvider": true,
"documentName": "v1",
"aspNetCoreEnvironment": null,
"createWebHostBuilderMethod": null,
"startupType": null,
"allowNullableBodyParameters": true,
"output": null,
"outputType": "Swagger2",
"newLineBehavior": "Auto",
"assemblyPaths": [],
"assemblyConfig": null,
"referencePaths": [
"$(HomeDir)/.nuget/packages"
],
"validateEnums": false,
"generateEnums": false,
"msBuildProjectExtensionsPath": null,
"configuration": "$(Configuration)",
"runtime": null,
"targetFramework": null,
"noBuild": true,
"msBuildOutputPath": null,
"verbose": true,
"workingDirectory": null,
"requireParametersWithoutDefault": false,
"apiGroupNames": null,
"useNuGetCache": false
}
},
Is there any other parameter to set?
I have checked the RicoSuter/NSwagPublic discussuin forum for the answer but could not get any.
The text was updated successfully, but these errors were encountered: