Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Squash null check in response object in latest version of NSwag.MSBuild 14.7.0 #4966

Open
metalic-skeleton opened this issue Aug 19, 2024 · 0 comments

Comments

@metalic-skeleton
Copy link

metalic-skeleton commented 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.

@metalic-skeleton 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant