Skip to content

OpenAPI Generated Code (DocumentationCommentIdHelper) is not annotated with GeneratedCodeAttribute #62705

@timdeschryver

Description

@timdeschryver

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I don't know if this is a real "bug", sorry if I created the wrong report.

It seems that some generated code is not annotated with the GeneratedCodeAttribute attribute. Because of this the code coverage of existing projects can drop by a few %.

The following screenshot shows the output from the reportgenerator CLI tool.

Image

Expected Behavior

I expect this code to be excluded from the code coverage.
This is already the case for other classes for the OpenAPI feature/file.

Steps To Reproduce

  • run tests with dotnet test -- --coverage --coverage-output ./coverage.xml --coverage-output-format cobertura
  • install the report generator CLI tool dotnet tool install -g dotnet-reportgenerator-globaltool
  • take a look at the coverage reportgenerator -reports:"Foo.Tests/bin/Debug/net10.0/TestResults/coverage.xml" -targetdir:"coveragereport" -reporttypes:"Html"

If wanted, I can create a repository where this is the case.

Exceptions (if any)

/

.NET Version

10.0.100-preview.5.25277.114

Anything else?

This can probably be fixed by adding the exclude attribute to

file static class DocumentationCommentIdHelper
and
file static class JsonNodeExtensions

Other types already include the attribute,

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-openapi

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions