atc-net / atc-rest-api-generator

A REST API code generator from OpenAPI Specification in YAML or Json file format
https://atc-net.github.io/repository/atc-rest-api-generator
MIT License
19 stars 4 forks source link

Broken generated code for ContentResult initialization produces build errors #78

Closed christianhelle closed 3 years ago

christianhelle commented 3 years ago

The following smoke test fails on the latest main branch:

Write-Host "Download Swagger Petstore v3 OpenAPI spec`n" -ForegroundColor Green
Invoke-WebRequest -Uri https://petstore3.swagger.io/api/v3/openapi.yaml -OutFile openapi.yaml

Write-Host "`nGenerate code`n" -ForegroundColor Green
Set-Location src/Atc.Rest.ApiGenerator.CLI
dotnet run -- generate server all -p "Swagger Petstore" -s ../../openapi.yaml --outputSlnPath ../../petstore3/ --outputSrcPath ../../petstore3/src --outputTestPath ../../petstore3/test -v true

Set-Location ../../
dotnet build ./petstore3

The generated code fails to build with the following errors:

C:\projects\atc\atc-rest-api-generator\petstore3\src\Swagger.Petstore.Api.Generated\Contracts\Pet\Results\UpdatePetWithFormResult.cs(30,190): error CS0103: The name 'Content' does not exist in the current context [C:\projects\atc\atc-rest-api-generator\petstore3\src\Swagger.Petstore.Api.Generated\Swagger.Petstore
.Api.Generated.csproj]
C:\projects\atc\atc-rest-api-generator\petstore3\src\Swagger.Petstore.Api.Generated\Contracts\Pet\Results\UpdatePetWithFormResult.cs(30,190): error CS0747: Invalid initializer member declarator [C:\projects\atc\atc-rest-api-generator\petstore3\src\Swagger.Petstore.Api.Generated\Swagger.Petstore.Api.Generated.cspr
oj]
C:\projects\atc\atc-rest-api-generator\petstore3\src\Swagger.Petstore.Api.Generated\Contracts\Pet\Results\UpdatePetResult.cs(45,174): error CS0103: The name 'Content' does not exist in the current context [C:\projects\atc\atc-rest-api-generator\petstore3\src\Swagger.Petstore.Api.Generated\Swagger.Petstore.Api.Gen
erated.csproj]
C:\projects\atc\atc-rest-api-generator\petstore3\src\Swagger.Petstore.Api.Generated\Contracts\Pet\Results\UpdatePetResult.cs(45,174): error CS0747: Invalid initializer member declarator [C:\projects\atc\atc-rest-api-generator\petstore3\src\Swagger.Petstore.Api.Generated\Swagger.Petstore.Api.Generated.csproj]
C:\projects\atc\atc-rest-api-generator\petstore3\src\Swagger.Petstore.Api.Generated\Contracts\Pet\Results\AddPetResult.cs(35,168): error CS0103: The name 'Content' does not exist in the current context [C:\projects\atc\atc-rest-api-generator\petstore3\src\Swagger.Petstore.Api.Generated\Swagger.Petstore.Api.Genera
ted.csproj]
C:\projects\atc\atc-rest-api-generator\petstore3\src\Swagger.Petstore.Api.Generated\Contracts\Pet\Results\AddPetResult.cs(35,168): error CS0747: Invalid initializer member declarator [C:\projects\atc\atc-rest-api-generator\petstore3\src\Swagger.Petstore.Api.Generated\Swagger.Petstore.Api.Generated.csproj]
C:\projects\atc\atc-rest-api-generator\petstore3\src\Swagger.Petstore.Api.Generated\Contracts\Store\Results\PlaceOrderResult.cs(35,176): error CS0103: The name 'Content' does not exist in the current context [C:\projects\atc\atc-rest-api-generator\petstore3\src\Swagger.Petstore.Api.Generated\Swagger.Petstore.Api.
Generated.csproj]
C:\projects\atc\atc-rest-api-generator\petstore3\src\Swagger.Petstore.Api.Generated\Contracts\Store\Results\PlaceOrderResult.cs(35,176): error CS0747: Invalid initializer member declarator [C:\projects\atc\atc-rest-api-generator\petstore3\src\Swagger.Petstore.Api.Generated\Swagger.Petstore.Api.Generated.csproj]
    1 Warning(s)
    8 Error(s)