Closed WolfgangHG closed 3 months ago
I could work around it by adding a switch "NSwagGenerateExceptionClasses" to the csproj file entry:
<ItemGroup>
<OpenApiReference Include="anonymizedapi.yaml" CodeGenerator="NSwagCSharp" Namespace="Anonymized.Namespace" ClassName="AnonymizedApi" NSwagGenerateExceptionClasses="true" />
</ItemGroup>
But this should probably be the default, instead of reporting an error.
Also, the generated class names changed for two classes in the yaml file. Those seem to be "hard to guess" names, as they previously had a number after the class name ("Data2"). But the new name starts with a lower case ("data"), and this is something I don't like in a C# environment ;-).
Same issue, but in my case I do not want to generate exception classes. I did have the
<ItemGroup>
<OpenApiReference Include="..\My.json" CodeGenerator="NSwagCSharp" ClassName="MyApiService" Link="OpenAPIs\My.json">
<Options>/generateClientInterfaces:true /useBaseUrl:false /operationGenerationMode:SingleClientFromOperationId /generateExceptionClasses:false /exceptionClass:My.ApiException /excludedTypeNames:ProblemDetails,ValidationProblemDetails</Options>
</OpenApiReference>
</ItemGroup>
Changed it to
<PropertyGroup>
<NSwagGenerateExceptionClasses>false</NSwagGenerateExceptionClasses>
</PropertyGroup>
<ItemGroup>
<OpenApiReference Include="..\My.json" CodeGenerator="NSwagCSharp" ClassName="MyApiService" Link="OpenAPIs\My.json">
<Options>/generateClientInterfaces:true /useBaseUrl:false /operationGenerationMode:SingleClientFromOperationId /exceptionClass:My.ApiException /excludedTypeNames:ProblemDetails,ValidationProblemDetails</Options>
</OpenApiReference>
</ItemGroup>
Duplicate of #4633 ?
You are right, it works with 14.0.4. Closing this issue. I thought I had done a search for this error before, but maybe the other issue was closed shortly before I created this one.
After updating a project from 13.20.0 to NSwag 14.0.3, I observe this error, and no cs file is generated:
C:\Users\<USERNAME>\.nuget\packages\nswag.apidescription.client\14.0.3\build\NSwag.ApiDescription.Client.targets(22,18): error MSB4100: Expected "%(NSwagGenerateExceptionClasses)" to evaluate to a boolean instead of "", in condition "!%(FirstForGenerator) OR !%(NSwagGenerateExceptionClasses)".
I reference a Yaml file.
I deleted and readded the csproj service reference, but there is no change:
Does anybody have an idea? I don't want to post the yaml file here, as it is not free.