我们在 REST API 项目中有 POST 端点,当状态代码为 200 时返回空响应。最近,当我们使用 NSwagMSBuild 的 v14.7.0 版本重新生成客户端时,我们看到它添加了附加...
REST API 项目中有 POST 端点,当状态代码为 200 时返回空响应。最近,当我们使用 NSwagMSBuild 的 v14.7.0 版本重新生成客户端时,我们看到它在响应对象上添加了额外的空检查,因此我们的测试现在失败了。
有没有办法配置不在最新版本的 NSwagMsbuild 中为特定(或所有)端点生成新的空检查?这是我的 NSwag.json 的文档生成部分。\'defaultResponseReferenceTypeNullHandling\': \'Null\' 已经(在另一个论坛中找到)
"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
}
},
还有其他参数需要设置吗?
我已经查看了 RicoSuter/NSwagPublic 讨论论坛以寻找答案,但没有得到任何答案。