OpenAPITools / OpenAPITools/openapi-generator
[BUG] aspnetcore server solution corrupt with empty sourceFolder
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
I created an ASP .NET Core server from CLI with the additional option sourceFolder= (empty). I used the public PetStore Open API spec in the newest version (currently 1.0.17). When I open the solution in VS 2022 (17.4.1) an error occurs: One or more projects in the solution were not loaded correctly.
openapi-generator version
6.2.1. I have not tested this in older versions.
OpenAPI declaration file content or url
Generation Details
openapi-generator-cli generate -i petstore.yaml -g aspnetcore -o PetStore.Web --package-name PetStore.Web --additional-properties=sourceFolder=
Steps to reproduce
- Open the solution in VS 2022
- Messagebox appears: One or more projects in the solution were not loaded correctly.
Related issues/PRs
Dont know any.
Suggest a fix
In the solution file the empty sourceFolder option gives this line:
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PetStore.Web", "****PetStore.Web\PetStore.Web.csproj", "{664D289C-2D20-4132-A227-5D738BD1BCD3}"
If you delete the leading backslash (highlighted in bold) then the solution open without any issues.
Workaround
If you do not want an additional subfolder in the solution directory for the server project specify sourceFolder=.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the openapi-generator-cli command with sourceFolder= and inspect the generated solution entry for PetStore.Web and its PetStore.Web.csproj path. Compare it with generation using sourceFolder=. and verify that the resulting solution opens in Visual Studio without the project-load error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, java, openapi
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100