OpenAPITools / OpenAPITools/openapi-generator
[BUG][aspnetcore] Resolve Conflict between Program.cs and launchProfile
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
There are multiple ways to specify the hosting Url for an aspnetcore application:
- Specifying it via Environment Variables
- Specifying it during development via
launchProfiles - Specifying it in code (Overwriting any other settings)
Currently the generator uses option 3:
https://github.com/OpenAPITools/openapi-generator/blob/5b6b4c9d4829b57716741dc35b3f1033e5483784/modules/openapi-generator/src/main/resources/aspnetcore/3.0/Program.mustache#L30
Which in my opinion is not alright, because as stated in the README.md:
https://github.com/OpenAPITools/openapi-generator/blob/5b6b4c9d4829b57716741dc35b3f1033e5483784/modules/openapi-generator/src/main/resources/aspnetcore/3.0/build.bat.mustache#L8
We should be able to use the launchProfiles. But as it is coded into the program it will always use serverPort.
Suggest a fix
Remove the line and maybe add a documentation link on how to setup the right port.
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 with modules/openapi-generator/src/main/resources/aspnetcore/3.0/Program.mustache, especially the hosting URL line linked in the issue, and compare it with Properties/launchSettings.json and the README reference in build.bat.mustache. Done means launchProfiles can determine the development port instead of always being overridden by serverPort.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100