Skip to content

Open API: Use Microsoft.AspNetCore.OpenApi for Open API document generation - #21058

Merged
lauraneto merged 118 commits into
v18/devfrom
v18/feature/microsoft-open-api-document-generation
Apr 30, 2026
Merged

Open API: Use Microsoft.AspNetCore.OpenApi for Open API document generation#21058
lauraneto merged 118 commits into
v18/devfrom
v18/feature/microsoft-open-api-document-generation

Merge branch 'v18/dev' into v18/feature/microsoft-open-api-document-g…

31d9932
Select commit
Loading
Failed to load commit list.
CodeScene Delta Analysis / CodeScene Code Health Review (v18/dev) failed Apr 30, 2026 in 44s

CodeScene PR Check

Quality Gate Failed

Gates Failed
Enforce critical code health rules (1 file with Bumpy Road Ahead)
Enforce advisory code health rules (12 files with Large Method, Code Duplication, Complex Conditional, Complex Method, Excess Number of Function Arguments, Constructor Over-Injection)

Gates Passed
2 Quality Gates Passed

See analysis details in CodeScene

Reason for failure
Enforce critical code health rules Violations Code Health Impact
MimeTypesTransformer.cs 1 critical rule 9.84 Suppress
Enforce advisory code health rules Violations Code Health Impact
SortTagsAndPathsTransformerTests.cs 1 advisory rule 9.39 Suppress
TagActionsByGroupNameTransformerTests.cs 1 advisory rule 9.39 Suppress
ApiKeyTransformerTests.cs 1 advisory rule 9.39 Suppress
MimeTypesTransformerTests.cs 1 advisory rule 9.39 Suppress
ResponseHeaderTransformerTests.cs 1 advisory rule 9.39 Suppress
RequireNonNullablePropertiesSchemaTransformerTests.cs 1 advisory rule 9.39 Suppress
BackOfficeSecurityRequirementsTransformerTests.cs 1 advisory rule 9.39 Suppress
BackOfficeSecurityRequirementsTransformer.cs 1 advisory rule 9.69 Suppress
NotificationHeaderTransformer.cs 1 advisory rule 9.69 Suppress
ResponseHeaderTransformer.cs 1 advisory rule 9.69 Suppress
OpenApiCustomDerivedTypeTest.cs 1 advisory rule 9.69 Suppress
UmbracoBuilderExtensions.cs 1 advisory rule 9.54 → 9.52 Suppress

Quality Gate Profile: Clean Code Collective
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.

Details

🚩 Declining Code Health (highest to lowest):

  • Code Duplication RequireNonNullablePropertiesSchemaTransformerTests.cs
  • Code Duplication SortTagsAndPathsTransformerTests.cs
  • Code Duplication TagActionsByGroupNameTransformerTests.cs
  • Code Duplication ApiKeyTransformerTests.cs
  • Code Duplication MimeTypesTransformerTests.cs
  • Code Duplication BackOfficeSecurityRequirementsTransformerTests.cs
  • Code Duplication ResponseHeaderTransformerTests.cs
  • Large Method UmbracoBuilderExtensions.cs: AddUmbracoManagementApi
  • Complex Conditional BackOfficeSecurityRequirementsTransformer.cs: TransformAsync
  • Complex Method NotificationHeaderTransformer.cs: TransformAsync
  • Excess Number of Function Arguments ResponseHeaderTransformer.cs: SetHeader
  • Constructor Over-Injection OpenApiCustomDerivedTypeTest.cs: CustomApiContentResponse
  • Bumpy Road Ahead MimeTypesTransformer.cs: TransformAsync

Annotations

Check warning on line 114 in src/Umbraco.Cms.Api.Management/DependencyInjection/UmbracoBuilderExtensions.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (v18/dev)

❌ Getting worse: Large Method

AddUmbracoManagementApi increases from 83 to 87 lines of code, threshold = 70. Large functions with many lines of code are generally harder to understand and lower the code health. Avoid adding more lines to this function.

Check warning on line 57 in src/Umbraco.Cms.Api.Common/OpenApi/MimeTypesTransformer.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (v18/dev)

❌ New issue: Bumpy Road Ahead

TransformAsync has 2 blocks with nested conditional logic. Any nesting of 2 or deeper is considered. Threshold is 2 blocks per function. The Bumpy Road code smell is a function that contains multiple chunks of nested conditional logic. The deeper the nesting and the more bumps, the lower the code health.

Check warning on line 36 in tests/Umbraco.Tests.UnitTests/Umbraco.Cms.Api.Common/OpenApi/SortTagsAndPathsTransformerTests.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (v18/dev)

❌ New issue: Code Duplication

The module contains 2 functions with similar structure: TransformAsync_Sorts_Tags_Alphabetically,TransformAsync_Sorts_Tags_Case_Sensitive. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.

Check warning on line 45 in tests/Umbraco.Tests.UnitTests/Umbraco.Cms.Api.Common/OpenApi/TagActionsByGroupNameTransformerTests.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (v18/dev)

❌ New issue: Code Duplication

The module contains 6 functions with similar structure: TransformAsync_Document_Handles_Null_Operations,TransformAsync_Document_Handles_Operations_Without_Tags,TransformAsync_Operation_Adds_Tag_To_Document_When_Not_Present,TransformAsync_Operation_Does_Not_Duplicate_Tag_In_Document and 2 more functions. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.

Check warning on line 82 in tests/Umbraco.Tests.UnitTests/Umbraco.Cms.Api.Delivery/OpenApi/ApiKeyTransformerTests.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (v18/dev)

❌ New issue: Code Duplication

The module contains 5 functions with similar structure: TransformAsync_Document_Preserves_Existing_Components,TransformAsync_Document_Preserves_Existing_Security_Schemes,TransformAsync_Operation_Adds_Security_Requirement,TransformAsync_Operation_Preserves_Existing_Security and 1 more functions. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.

Check warning on line 48 in tests/Umbraco.Tests.UnitTests/Umbraco.Cms.Api.Delivery/OpenApi/MimeTypesTransformerTests.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (v18/dev)

❌ New issue: Code Duplication

The module contains 6 functions with similar structure: TransformAsync_Consumes_Preserves_Schema_From_Existing_Entry,TransformAsync_Consumes_With_Multiple_ContentTypes_Keeps_All_Declared,TransformAsync_Keeps_Only_Consumes_ContentTypes_For_RequestBody,TransformAsync_Preserves_All_MimeTypes_When_Json_Not_Present and 2 more functions. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.

Check warning on line 40 in tests/Umbraco.Tests.UnitTests/Umbraco.Cms.Api.Management/OpenApi/ResponseHeaderTransformerTests.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (v18/dev)

❌ New issue: Code Duplication

The module contains 2 functions with similar structure: TransformAsync_Adds_GeneratedResource_Header_For_201_Response,TransformAsync_Adds_Location_Header_For_201_Response. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.

Check warning on line 63 in tests/Umbraco.Tests.UnitTests/Umbraco.Cms.Api.Common/OpenApi/RequireNonNullablePropertiesSchemaTransformerTests.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (v18/dev)

❌ New issue: Code Duplication

The module contains 5 functions with similar structure: TransformAsync_Adds_NonNullable_Properties_To_Required,TransformAsync_Does_Not_Duplicate_Already_Required_Properties,TransformAsync_Skips_Nullable_Properties,TransformAsync_Skips_Nullable_Schema_Type_For_Unknown_Properties and 1 more functions. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.

Check warning on line 140 in tests/Umbraco.Tests.UnitTests/Umbraco.Cms.Api.Management/OpenApi/BackOfficeSecurityRequirementsTransformerTests.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (v18/dev)

❌ New issue: Code Duplication

The module contains 6 functions with similar structure: TransformAsync_Operation_Adds_401_Response_For_Authorized_Endpoints,TransformAsync_Operation_Adds_403_Response_For_Controller_With_IAuthorizationService_Injection,TransformAsync_Operation_Adds_403_Response_For_Multiple_Authorize_Attributes,TransformAsync_Operation_Adds_Security_Requirement_For_Authorized_Endpoints and 2 more functions. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.

Check warning on line 30 in src/Umbraco.Cms.Api.Management/OpenApi/Transformers/BackOfficeSecurityRequirementsTransformer.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (v18/dev)

❌ New issue: Complex Conditional

TransformAsync has 1 complex conditionals with 2 branches, threshold = 2. A complex conditional is an expression inside a branch (e.g. if, for, while) which consists of multiple, logical operators such as AND/OR. The more logical operators in an expression, the more severe the code smell.

Check warning on line 81 in src/Umbraco.Cms.Api.Management/OpenApi/Transformers/NotificationHeaderTransformer.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (v18/dev)

❌ New issue: Complex Method

TransformAsync has a cyclomatic complexity of 9, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.

Check warning on line 65 in src/Umbraco.Cms.Api.Management/OpenApi/Transformers/ResponseHeaderTransformer.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (v18/dev)

❌ New issue: Excess Number of Function Arguments

SetHeader has 5 arguments, max arguments = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.

Check warning on line 81 in tests/Umbraco.Tests.Integration/Umbraco.Api.Delivery/OpenApi/OpenApiCustomDerivedTypeTest.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (v18/dev)

❌ New issue: Constructor Over-Injection

CustomApiContentResponse has 8 arguments, max arguments = 5. This constructor has too many arguments, indicating an object with low cohesion or missing function argument abstraction. Avoid adding more arguments.