Skip to content

Conversation

@IeuanWalker
Copy link
Owner

No description provided.

Added EndpointRequestTypeMapperTests covering mapping and resolution logic for endpoint request types, including various scenarios (no data source, filtering, versioned routes). Refactored IeuanWalker.MinimalApi.Endpoints.Tests.csproj to consolidate Shouldly and NSubstitute package references into the main ItemGroup for better organization.
Switched from FormatterServices.GetUninitializedObject to
RuntimeHelpers.GetUninitializedObject for creating uninitialized
test instances, updating using directives accordingly. This avoids
the use of obsolete APIs and modernizes the test code.
Added OpenApiConstantsTests to cover SchemaConstants methods: IsSystemType, IsNullableType, IsCollectionType, IsDictionaryType, and ArraySuffix constant. Tests use xUnit theories to validate various input scenarios and expected results.
Introduce OpenApiPathMatcherTests to cover various path matching
scenarios, including case insensitivity, parameter normalization,
version placeholders, and mismatch cases. These tests improve
confidence in the correctness and robustness of the PathsMatch method.
Introduces OpenApiSchemaHelperTests with comprehensive coverage
of schema handling, including primitives, arrays, generics,
nullable types, enum references, and schema enrichment. Ensures
correct behavior of OpenApiSchemaHelper methods.
Introduce SchemaTypeResolverTests to validate type resolution, enum handling (including nullable enums), assembly filtering, loadable type retrieval, and caching behavior. Ensures correct handling of system, custom, and invalid types.
Introduce PropertyValidationBuilderTests to verify rule building, append flag handling, operation management, and argument validation. Tests cover exception handling and ensure correct logic for Length, MinLength, MaxLength, Pattern, and Between methods.
Introduce ValidationConfigurationBuilderTests to verify rule collection, operation tracking, and property description behavior for simple, nested, and array properties. Tests ensure correct rule building and configuration overrides.
Introduced ValidationRuleTests covering RequiredRule, StringLengthRule, PatternRule, EmailRule, UrlRule, RangeRule, CustomRule, DescriptionRule, and EnumRule. Tests verify property assignment, default error messages, and exception handling for invalid arguments and constructor parameters.
Introduce ValidationRuleOperationTests to cover AlterOperation, RemoveOperation, and RemoveAllOperation behaviors. Tests ensure correct rule modification, removal, clearing, and exception handling for invalid operations or missing targets.
Added EnumSchemaTransformerTests to cover cases with no schemas, missing schema types, and enrichment of schemas with enum metadata. Includes a local enum for testing.
Added NullableSchemaReorderTransformerTests to verify correct reordering of nullable schemas in oneOf scenarios. Tests cover cases with no schemas, null type schemas, and nullable extension markers. Included necessary using directives and assertions for validation.
Comprehensive tests for TypeDocumentTransformer covering schema inlining, enum handling, collection/dictionary removal, and OpenAPI edge cases. Also fixed FixInlineSchemaType to check IFormFileCollection before IFormFile to ensure correct schema typing.
Comprehensive tests cover schema removal logic, including handling of null/empty components, referenced/unreferenced schemas, nested and composed schemas, headers, inline and circular references, and cancellation support. Uses Shouldly for assertions and includes helpers for mock OpenAPI documents and contexts.
Introduce ValidationDocumentTransformerTests covering constructor defaults, property mutability, interface implementation, and extensive TransformAsync scenarios. Tests ensure robustness against various OpenApiDocument structures, configuration options, and edge cases. No production code changes; improves test coverage and reliability.
Replaced all tests in ValidationDocumentTransformerTests.cs to focus on unit testing the CreateInlineSchemaWithAllValidation method. The new tests cover a broad range of validation rule scenarios (required, length, pattern, email, URL, range, description, custom, enum, nullable, array, multiple rules, extension and format preservation, and append rules behavior). Removed previous integration-style tests for TransformAsync. Added helper methods and enums for clarity and maintainability.
Added comprehensive unit tests for SecuritySchemeTransformer covering all supported authentication schemes, options, and edge cases. Also performed minor code cleanups in other test files, including exception handling, removal of unused variables, and improved parameter naming.
Relocated the InternalsVisibleTo attribute from InternalsVisibleTo.cs to IeuanWalker.MinimalApi.Endpoints.csproj, allowing test project access to internal members via the project file instead of a source file. Removed the now-unnecessary InternalsVisibleTo.cs.
Refactored FluentValidationExtensionsTests to improve clarity and structure of IsInEnum tests. Added explicit Arrange/Act/Assert sections, enhanced assertions for exception parameter names and error messages, and replaced condensed tests with more descriptive cases for non-enum types, valid/invalid values, and nullable scenarios.
Removed unit tests that used reflection to verify internal transformer state in OpenApiOptions. Also deleted related helper methods. Tests now only assert that extension methods return the same instance, focusing on public API behavior rather than internal implementation details.
Reformatted TestModel object initialization in both test methods to use multi-line syntax for improved readability. Also replaced "" with string.Empty for Name in the validation failure test. No functional changes were made.
Refactored test helper classes and context creation for clarity and maintainability. Moved helper classes to the end of the file, replaced reflection-based context setup with object initializers, and used method group conversions for MethodInfo retrieval. Cleaned up unused usings and improved code idiomatic usage without changing test logic.
Updated OpenApiConstantsTests to explicitly follow the Arrange-Act-Assert structure in all test methods. Each test now assigns method results to variables before assertions, improving readability and consistency. The ArraySuffix constant test was also refactored accordingly.
Refactored OpenApiPathMatcherTests to use Shouldly's ShouldBe and ShouldBeFalse assertions instead of xUnit's Assert methods. Added comments to clearly separate Arrange, Act, and Assert phases in each test for better readability and maintainability.
Refactored OpenApiSchemaHelperTests to explicitly separate Arrange, Act, and Assert sections in each test. This improves readability and maintainability without changing any test logic or behavior.
Replaced xUnit Assert methods with Shouldly assertions in SchemaTypeResolverTests.cs for improved readability. Moved TestEnum inside the test class to limit its scope.
Nested and TestRequest classes are now defined as nested types
within ValidationConfigurationBuilderTests, limiting their scope
to the test class and improving encapsulation. No changes were
made to their implementations.
Replaced xUnit Assert with Shouldly for clearer, more expressive test assertions. Simplified assembly access in SchemaTypeResolverTests and moved TestEnum outside the test class. Improved exception message checks and renamed tests for clarity. Overall, these changes modernize and streamline the test codebase.
Refactored ValidationRuleTests to use Shouldly for assertions, improving readability and error messages. Split PatternRule and EnumRule tests for clearer coverage of exception cases and property validation.
Moved test helper methods to bottom of ValidationDocumentTransformerTests.cs for better organization and changed the class to non-partial. Fixed a misplaced bracket in TypeDocumentTransformerTests.cs to correctly terminate an OpenApiSchema array. No logic changes were made to the helper methods.
IeuanWalker and others added 20 commits January 15, 2026 15:12
Switched to RuntimeHelpers.GetUninitializedObject for creating
OpenApiOperationTransformerContext instances, removing usage of
obsolete FormatterServices and related warning suppression.
Expanded test coverage across validation, OpenAPI mapping, and utility components.
- Added edge case and boundary tests for enum validation, string utilities, and property validation builders.
- Introduced extensive tests for OpenAPI path matching, endpoint-to-request type mapping, and schema type resolution.
- Verified all constant values and format strings in SchemaConstants.
- Improved reliability by covering error conditions, edge cases, and expected behaviors for all validation rule types and operations.
Moved SampleRequest, TestModel, and OtherModel classes to the end of their respective test files to improve code structure and maintainability. No functional changes were made.
Replaced null-forgiving assertions with explicit null checks in unit tests for better error reporting. Also reordered and cleaned up using and namespace statements in ValidationRuleOperationTests.cs for clarity.
Refactored test code to directly construct OpenApiDocumentTransformerContext using object initializers, eliminating the use of reflection and RuntimeHelpers. Updated test helpers and classes to set properties explicitly. Removed most BuildEndpointToRequestTypeMapping tests and reorganized remaining helpers for clarity and maintainability. These changes improve test readability and reduce reliance on internal implementation details.
Added a unit test to ensure that TransformAsync does not modify the OpenApiOperation's Description when ApiDescription.ActionDescriptor is null in AuthorizationPoliciesAndRequirementsOperationTransformerTests. This improves test coverage for edge cases.
Expanded EndpointRequestTypeMapperTests with new cases for non-route endpoints, missing MethodInfo, empty route patterns, and missing EndpointDataSource. Added SimpleEndpointDataSource helper for test setup. Refactored CreateContext in AuthorizationPoliciesAndRequirementsOperationTransformerTests for clarity and null-safety. Added required usings and reorganized test helpers.
Added comprehensive unit tests for OpenApiSchemaHelper covering primitive schema creation, type/format extraction, .NET type mapping, nullable and enum handling, schema reference transformation, and OpenAPI reference resolution. Refactored ResolveReference logic for clarity. Improved code style in EndpointRequestTypeMapperTests.
Refactored SchemaTypeResolver to accept delegates for assembly and type retrieval, improving testability and error handling. Extracted ShouldInspectAssemblyName for direct testing. Updated usages and expanded unit tests to cover exception scenarios and edge cases. Made minor formatting improvements for clarity.
Added TransformAsync_WhenSchemaIsReference_DoesNotModifySchema unit test to EnumSchemaTransformerTests. This test verifies that EnumSchemaTransformer does not alter schemas that are OpenApiSchemaReference instances.
Added a comprehensive suite of unit tests to NullableSchemaReorderTransformerTests, covering edge cases such as null or unresolved schemas, references, and components. Tests verify correct reordering of nullable types in oneOf, allOf, and anyOf arrays, and ensure the transformer handles incomplete or malformed OpenAPI documents without throwing exceptions. This greatly improves test coverage and robustness.

Add extensive unit tests for NullableSchemaReorderTransformer

Added multiple tests covering TransformAsync edge cases, including null and unresolved references, missing schemas, nested constructs, and correct reordering for allOf/anyOf/oneOf. Improves coverage and robustness of transformer behavior.
Expanded TypeDocumentTransformerTests with many new scenarios:
- Array schemas with nullable markers and OneOf/Items handling
- Parameter skipping for null schemas and empty names
- Nullable enum reference unwrapping and malformed refs
- Inlining primitives and IFormFile schemas in requests/components
- Skipping non-system references and non-OpenApiPathItem entries
- Double-wrapped array unwrapping in various forms
- Robustness against null paths/components and non-OpenApiSchema entries
Added supporting test types and helpers. Improves coverage and error handling validation.
Reversed OneOf schema expectations in TypeDocumentTransformerTests to match new behavior. Added a test in ValidationConfigurationBuilderTests to ensure using the entire object as a property selector throws an ArgumentException.
- Add SkipAutoProps to Coverlet config to improve coverage accuracy
- Remove obsolete ResponseModel from Todos.Delete endpoint
- Add/annotate request models and validators with ExcludeFromCodeCoverage
- Update PatchTodo integration test to use real model and verify all fields
- Refine validation logic and coverage exclusions across endpoints
Refactored the logic for handling nullable wrapper schemas to improve clarity and robustness in distinguishing between nullable markers and actual type schemas. Expanded the OpenAPI specification with detailed validation metadata, including property-level rules, nullable support, and improved documentation. Introduced a new endpoint for FluentValidation edge cases with a corresponding request model and validator, and updated tests to reflect these enhancements.
Added a rule to RequestValidator to ensure that either Uprn is provided, or both Easting and Northing are present. Displays a clear validation message if neither condition is met.
Adjusted the indentation of the .Must() rule for the composite object { x.Uprn, x.Easting, x.Northing } in RequestValidator to improve code readability. No functional changes were made.
Refactored the validation rule for UPRN or easting/northing to move the .WithMessage() call to a new line for better readability. No changes to validation logic or behavior.
Added support for extracting and documenting multi-property validation rules in FluentValidation, improving the accuracy of validation document transformation. Expanded and updated OpenAPI schema definitions and tags for better API documentation clarity. Refreshed test expectations for validation-related OpenAPI components to match the latest schema output.
Modernize test code with collection initializers, explicit types, and null-safe access. Simplify FluentValidation multi-property rule extraction by removing unused parameters and clarifying logic. Improve code readability, consistency, and maintainability without changing core functionality.
@github-actions
Copy link

Summary

Summary
Generated on: 1/23/2026 - 11:41:08 PM
Coverage date: 1/23/2026 - 11:40:52 PM - 1/23/2026 - 11:40:58 PM
Parser: MultiReport (4x Cobertura)
Assemblies: 3
Classes: 87
Files: 71
Line coverage: 89.7% (5193 of 5783)
Covered lines: 5193
Uncovered lines: 590
Coverable lines: 5783
Total lines: 10055
Branch coverage: 82.3% (2427 of 2947)
Covered branches: 2427
Total branches: 2947
Method coverage: Feature is only available for sponsors
Tag: 380_21304828627

Coverage

ExampleApi - 94.4%
Name Line Branch
ExampleApi 94.4% 51.5%
ExampleApi.Data.InMemoryTodoStore 100% 100%
ExampleApi.EndpointExtensions 95.4%
ExampleApi.Endpoints.Enum.GetFromQuery.RequestModelValidator 100%
ExampleApi.Endpoints.Enum.PostFromBody.RequestModelValidator 100%
ExampleApi.Endpoints.FileHandling.PostListOfFiles.PostFileHandlingListOfFil
esEndpoint
100%
ExampleApi.Endpoints.FileHandling.PostMultipart.PostFileHandlingMultipartEn
dpoint
100% 66.6%
ExampleApi.Endpoints.FileHandling.PostSingleFile.PostFileHandlingSingleFile
Endpoint
100%
ExampleApi.Endpoints.Todos.Delete.DeleteTodoEndpoint 100%
ExampleApi.Endpoints.Todos.GetAll.GetAllTodosEndpoint 100%
ExampleApi.Endpoints.Todos.GetById.GetTodoByIdEndpoint 100% 100%
ExampleApi.Endpoints.Todos.GetExport.GetExportEndpoint 100% 83.3%
ExampleApi.Endpoints.Todos.Patch.PatchTodoEndpoint 100% 100%
ExampleApi.Endpoints.Todos.Post.PostTodoEndpoint 100%
ExampleApi.Endpoints.Todos.Post.RequestModelValidator 100%
ExampleApi.Endpoints.Todos.Post.ResponseModel 100%
ExampleApi.Endpoints.Todos.Put.PutTodoEndpoint 100% 100%
ExampleApi.Endpoints.TypeExamples.TypeExamplesEndpointGroup 100%
ExampleApi.Endpoints.Validation.GetDataAnnotationsFromQuery.GetFluentValida
tionFromQuery
0%
ExampleApi.Endpoints.Validation.GetDataAnnotationsFromQuery.RequestModelVal
idators
0% 0%
ExampleApi.Endpoints.Validation.GetDataAnnotationsFromQuery.WithDefaultErro
rMessageAttribute
28.5% 0%
ExampleApi.Endpoints.Validation.GetDataAnnotationsFromQuery.WithoutDefaultE
rrorMessageAttribute
23% 0%
ExampleApi.Endpoints.Validation.GetFluentValidationFromQuery.GetFluentValid
ationFromQuery
0%
ExampleApi.Endpoints.Validation.GetFluentValidationFromQuery.RequestModelVa
lidator
98% 0%
ExampleApi.Endpoints.Validation.PostDataAnnotationsFromBody.PostDataValidat
ionEndpoint
0%
ExampleApi.Endpoints.Validation.PostFluentValidation.NestedObjectModelValid
ator
100% 50%
ExampleApi.Endpoints.Validation.PostFluentValidation.PostFluentValidationEn
dpoint
0%
ExampleApi.Endpoints.Validation.PostFluentValidation.RequestModelValidator 100% 100%
ExampleApi.Endpoints.Validation.PostFluentValidationFromFrom.NestedObjectMo
delValidator
100% 0%
ExampleApi.Endpoints.Validation.PostFluentValidationFromFrom.PostFluentVali
dationFromFromEndpoint
0%
ExampleApi.Endpoints.Validation.PostFluentValidationFromFrom.RequestModelVa
lidator
98.1% 0%
ExampleApi.Endpoints.WeatherForecast.Get.V1.GetWeatherForecastEndpoint 100%
ExampleApi.Endpoints.WeatherForecast.Get.V2.GetWeatherForecastEndpoint 100%
Program 100%
IeuanWalker.MinimalApi.Endpoints - 87.1%
Name Line Branch
IeuanWalker.MinimalApi.Endpoints 87.1% 81.9%
IeuanWalker.MinimalApi.Endpoints.Extensions.StringExtensions 100% 100%
IeuanWalker.MinimalApi.Endpoints.Filters.FluentValidationFilter`1 100% 100%
IeuanWalker.MinimalApi.Endpoints.FluentValidationEnumExtensions 100% 100%
IeuanWalker.MinimalApi.Endpoints.OpenApiDocumentTransformers.AuthorizationP
oliciesAndRequirementsOperationTransformer
100% 92.3%
IeuanWalker.MinimalApi.Endpoints.OpenApiDocumentTransformers.RequestPropert
yEnhancer.Core.EndpointRequestTypeMapper
100% 100%
IeuanWalker.MinimalApi.Endpoints.OpenApiDocumentTransformers.RequestPropert
yEnhancer.Core.OpenApiPathMatcher
100% 100%
IeuanWalker.MinimalApi.Endpoints.OpenApiDocumentTransformers.RequestPropert
yEnhancer.Core.OpenApiSchemaHelper
97% 93%
IeuanWalker.MinimalApi.Endpoints.OpenApiDocumentTransformers.RequestPropert
yEnhancer.Core.SchemaConstants
100% 100%
IeuanWalker.MinimalApi.Endpoints.OpenApiDocumentTransformers.RequestPropert
yEnhancer.Core.SchemaTypeResolver
100% 100%
IeuanWalker.MinimalApi.Endpoints.OpenApiDocumentTransformers.RequestPropert
yEnhancer.EnumSchemaTransformer
100% 90%
IeuanWalker.MinimalApi.Endpoints.OpenApiDocumentTransformers.RequestPropert
yEnhancer.NullableSchemaReorderTransformer
100% 93.2%
IeuanWalker.MinimalApi.Endpoints.OpenApiDocumentTransformers.RequestPropert
yEnhancer.TypeDocumentTransformer
95% 90.7%
IeuanWalker.MinimalApi.Endpoints.OpenApiDocumentTransformers.RequestPropert
yEnhancer.UnusedComponentsCleanupTransformer
91.7% 83.6%
IeuanWalker.MinimalApi.Endpoints.OpenApiDocumentTransformers.RequestPropert
yEnhancer.Validation.AlterOperation
100% 100%
IeuanWalker.MinimalApi.Endpoints.OpenApiDocumentTransformers.RequestPropert
yEnhancer.Validation.CustomRule`1
100%
IeuanWalker.MinimalApi.Endpoints.OpenApiDocumentTransformers.RequestPropert
yEnhancer.Validation.DescriptionRule
100%
IeuanWalker.MinimalApi.Endpoints.OpenApiDocumentTransformers.RequestPropert
yEnhancer.Validation.EmailRule
100% 100%
IeuanWalker.MinimalApi.Endpoints.OpenApiDocumentTransformers.RequestPropert
yEnhancer.Validation.EnumRule
100% 100%
IeuanWalker.MinimalApi.Endpoints.OpenApiDocumentTransformers.RequestPropert
yEnhancer.Validation.PatternRule
100% 100%
IeuanWalker.MinimalApi.Endpoints.OpenApiDocumentTransformers.RequestPropert
yEnhancer.Validation.PropertyValidationBuilder`2
100% 100%
IeuanWalker.MinimalApi.Endpoints.OpenApiDocumentTransformers.RequestPropert
yEnhancer.Validation.RangeRule`1
100% 100%
IeuanWalker.MinimalApi.Endpoints.OpenApiDocumentTransformers.RequestPropert
yEnhancer.Validation.RemoveAllOperation
100% 100%
IeuanWalker.MinimalApi.Endpoints.OpenApiDocumentTransformers.RequestPropert
yEnhancer.Validation.RemoveOperation
100% 100%
IeuanWalker.MinimalApi.Endpoints.OpenApiDocumentTransformers.RequestPropert
yEnhancer.Validation.RequiredRule
100% 100%
IeuanWalker.MinimalApi.Endpoints.OpenApiDocumentTransformers.RequestPropert
yEnhancer.Validation.StringLengthRule
100% 100%
IeuanWalker.MinimalApi.Endpoints.OpenApiDocumentTransformers.RequestPropert
yEnhancer.Validation.UrlRule
100% 100%
IeuanWalker.MinimalApi.Endpoints.OpenApiDocumentTransformers.RequestPropert
yEnhancer.Validation.ValidationConfiguration`1
100%
IeuanWalker.MinimalApi.Endpoints.OpenApiDocumentTransformers.RequestPropert
yEnhancer.Validation.ValidationConfigurationBuilder`1
97.4% 85.2%
IeuanWalker.MinimalApi.Endpoints.OpenApiDocumentTransformers.RequestPropert
yEnhancer.Validation.ValidationMetadata`1
100% 50%
IeuanWalker.MinimalApi.Endpoints.OpenApiDocumentTransformers.RequestPropert
yEnhancer.Validation.ValidationRule
100%
IeuanWalker.MinimalApi.Endpoints.OpenApiDocumentTransformers.RequestPropert
yEnhancer.ValidationDocumentTransformer
74.5% 69.4%
IeuanWalker.MinimalApi.Endpoints.OpenApiDocumentTransformers.SecurityScheme
Transformer
100% 100%
IeuanWalker.MinimalApi.Endpoints.OpenApiDocumentTransformers.SecurityScheme
TransformerOptions
100%
IeuanWalker.MinimalApi.Endpoints.OpenApiExtensions 93% 100%
IeuanWalkerMinimalApiEndpoints.EndpointExtensions 0%
IeuanWalker.MinimalApi.Endpoints.Generator - 95.9%
Name Line Branch
IeuanWalker.MinimalApi.Endpoints.Generator 95.9% 88.8%
IeuanWalker.MinimalApi.Endpoints.Generator.AbstractValidatorInfo 100%
IeuanWalker.MinimalApi.Endpoints.Generator.Block 100% 100%
IeuanWalker.MinimalApi.Endpoints.Generator.CachableLocation 100% 83.3%
IeuanWalker.MinimalApi.Endpoints.Generator.DiagnosticInfo 100%
IeuanWalker.MinimalApi.Endpoints.Generator.EndpointGenerator 98.2% 86.7%
IeuanWalker.MinimalApi.Endpoints.Generator.EndpointGroupInfo 100%
IeuanWalker.MinimalApi.Endpoints.Generator.EndpointInfo 100%
IeuanWalker.MinimalApi.Endpoints.Generator.Extensions.SourceGeneratorExtens
ions
100% 92.3%
IeuanWalker.MinimalApi.Endpoints.Generator.Extensions.StringExtensions 100% 100%
IeuanWalker.MinimalApi.Endpoints.Generator.Helpers.EndpointGeneratorHelpers 95.8% 95.6%
IeuanWalker.MinimalApi.Endpoints.Generator.Helpers.HttpVerbRouteHelpers 93.6% 85.7%
IeuanWalker.MinimalApi.Endpoints.Generator.Helpers.MapGroupHelpers 88.4% 78.8%
IeuanWalker.MinimalApi.Endpoints.Generator.Helpers.RequestBindingTypeHelper
s
95.8% 92.6%
IeuanWalker.MinimalApi.Endpoints.Generator.Helpers.ValidationHelpers 94.8% 90.9%
IeuanWalker.MinimalApi.Endpoints.Generator.Helpers.WithNameHelpers 100% 91.6%
IeuanWalker.MinimalApi.Endpoints.Generator.Helpers.WithTagsHelpers 94.3% 91.9%
IeuanWalker.MinimalApi.Endpoints.Generator.IndentedTextBuilder 100%
IeuanWalker.MinimalApi.Endpoints.Generator.TypeInfo 100%
IeuanWalker.MinimalApi.Endpoints.Generator.ValidatorInfo 100%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants