OpenAPITools / OpenAPITools/openapi-generator
[BUG] [aspnetcore] Generated code produces warnings
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
When generating an aspnetcore server, the output produces several compiler warnings.
openapi-generator version
6.01
Generation Details
openapi-generator-cli generate -i <spec> -g aspnetcore -o <output> --package-name <packageName> --additional-properties=classModifier=abstract --additional-properties=buildTarget=library
Steps to reproduce
There are warnings in Attributes\ValidateModelStateAttribute.cs and Converters\CustomEnumConverter.cs: CS8603: Possible null reference return
Formatters\InputFormatterStream.cs is missing XML-doc comments
Related issues/PRs
Couldn't find any
Suggest a fix
Add XML-doc comments to modules\openapi-generator\src\main\resources\aspnetcore\3.0\Formatters\InputFormatterStream.mustache
Compiler warnings can be resolved by including {>partial_header} at the top of modules\openapi-generator\src\main\resources\aspnetcore\3.0\typeConverter.mustache and modules\openapi-generator\src\main\resources\aspnetcore\3.0\validateModel.mustache.
This adds the <auto-generated> tag as a comment, which causes the compiler to ignore the issues.
I have a fix ready for this, but can't seem to get access to push my code and create a PR.
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 the ASP.NET Core templates modules/openapi-generator/src/main/resources/aspnetcore/3.0/Formatters/InputFormatterStream.mustache, typeConverter.mustache, and validateModel.mustache. Generate an aspnetcore server using the command shown, then verify that the generated project no longer reports CS8603 warnings and the missing XML-doc comments in InputFormatterStream.cs are addressed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend, tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100