Open alfredo-accuris opened 2 months ago
Take it a step further and say the expected is global::System.IO.Path.GetTempPath()
You are right, I changed the file modules/openapi-generator/src/main/resources/csharp/ApiClient.mustache to import the Path
as using Path = global::System.IO.Path;
and it avoid any collation.
Changing the expected to import as global::
The newest version of the api generator v7.7.0 (#18915) removes specific namespaces (System.IO.Path) for templates on Csharp. This produces autogenerated code that may have conflict when imported to an existing project if there is an existing Path class.
To solve the problem, either the existing project has to rename their classes or add the missing namespaces in the autogenerated code.
Bug Report Checklist
On the latest release the issue #18915 remove namespaces from the mustash templates ware added.
actual output:
ApiClient.cs
Expected:
Description
The newest version of the api generator v7.7.0 (#18915) removes specific namespaces (System.IO.Path) for templates on Csharp. This produces autogenerated code that may have conflict when imported to an existing project if there is an existing Path class.
openapi-generator version
v7.7.0
OpenAPI declaration file content or url
Using a single schema the generated code removes the namespaces
Generation Details
Executing the docker
Steps to reproduce
Execute the lastes version
docker run --rm openapitools/openapi-generator-cli:v7.7.0 generate -i ./swagger.json --package-name Sdk.Simple -g csharp -o ./Sdk/Simple --additional-properties targetFramework=net8.0
The output code in /Sdk.Simple /Client/ApiClient.cs does not have the namespaces
Related issues/PRs
18915 removed namespaces for PATH
Suggest a fix
Fully qualify the autogenerate clases to avoid collision when importing on another project