Conversation
- Added 13 new tests to exercise OpenAPI schema generation code paths - Tests now verify getSchema function for all parameter types (s, i, b, c, d, f, u, O) - Tests exercise addOpenApiSimple type matching logic for all combinations - Improved coverage of Oxpecker.OpenApi/Routing.fs from 31.71% to 41.46% (+9.76%) - Overall project line coverage improved from 86.64% to 86.91% (+0.27%) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds comprehensive tests for the OpenAPI routing schema generation code in
Oxpecker.OpenApi/Routing.fs, significantly improving test coverage of previously untested code paths.Changes Made
tests/Oxpecker.OpenApi.Tests/Routing.Tests.fsgetSchemafunction for all parameter type format specifiers:%s(string) -%i(int) -%b(bool) -%c(char)%d(int64) -%f(float) -%u(uint64) -%O(Guid/object)addOpenApiSimpletype matching logic for all four type combinations:.WithOpenApi()configuration callbacks to exercise schema parameter generation codeTest Coverage Results
Detailed Coverage Improvement
The new tests cover:
getSchemafunction that maps format characters to OpenAPI schemas.WithOpenApi()configuration that adds parameters to operationsaddOpenApiSimpleThese were previously completely untested (0% coverage).
Replicating the Test Coverage Measurements
To replicate these coverage measurements:
Future Improvement Opportunities
Based on the coverage analysis, other areas with low coverage that could benefit from additional tests:
Testing Strategy
The tests use a mock
IEndpointConventionBuilderto execute the configuration callbacks without requiring a full ASP.NET Core application context. This approach:Commands Executed
Web Searches Performed
None
Web Pages Fetched
None
🤖 Generated with Claude Code