chore: refactor all tests by category#2260
chore: refactor all tests by category#2260mromaszewicz wants to merge 3 commits intooapi-codegen:mainfrom
Conversation
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
Greptile SummaryThis PR successfully reorganizes the internal test directory from an organic, issue-numbered structure into a clean feature-based taxonomy. The refactoring deletes 52k lines while adding only 10k, demonstrating significant simplification. Key improvements:
Test coverage: Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| internal/test/tools.go | Added tools.go with go:build constraint to keep oapi-codegen dependency in go.mod for go:generate directives |
| internal/test/go.mod | Cleaned up dependencies, removing unused framework imports (gin, iris, gorilla, etc.) |
| internal/test/components/primitives/primitives_test.go | Comprehensive tests for primitive types, enums, formats, and JSON round-trip serialization |
| internal/test/parameters/path/simple/path_simple_test.go | Thorough testing of simple-style path parameters with explode/noExplode for primitives, arrays, and objects |
| internal/test/externalref/externalref_test.go | Tests external ref qualification in responses (issue-2113), verifying proper package import |
| internal/test/externalref/config.api.yaml | API config with import-mapping for external common package references |
Last reviewed commit: 5d69e3b
|
This code review is quite immense. It might be easier to look at my source branch to see what the layout looks like. I think it will be a lot easier to add test cases for specific things once this is merged. |
|
@mromaszewicz would you like this change in before any other PRs? What's your priority order for these to avoid conflcits/rebasing fun? |
|
I will use AI to rebase this, it shines there. I'd like to get this in just as a quality of life improvement. It exposed some issues we have with matrix and label parameters as-is (so tests are disabled for now). |
Replace the organically-grown test directory structure (issue-numbered
directories, flat parameter/component tests) with a feature-based taxonomy
that makes coverage visible at a glance.
New structure:
components/{primitives,objects,nullable,recursive}
aggregates/{allof,anyof,oneof}
parameters/{path/{simple,label,matrix},query/{form,deep_object},
header/simple,cookie/form,content,precedence,encoding}
externalref/ (multi-package external $ref qualification)
Each directory contains a minimal OpenAPI spec exercising one feature,
a config.yaml, a doc.go with go:generate, committed generated code,
and round-trip tests that instantiate types and verify JSON marshaling.
Key changes:
- Absorb issue-specific directories into feature categories
- Delete old flat test directories (server/, strict-server/, client/,
schemas/, cookies/, compatibility/, filter/, outputoptions/, etc.)
- Add comprehensive parameter permutation coverage across all
location x style x explode x value-type combinations
- Fold issue-2113 (external ref in responses) into externalref/
- Add tools.go to keep oapi-codegen/v2 in go.mod for go:generate
(previously kept alive implicitly by old test imports)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move header and cookie nil-check tests from issues/issue-2238/ into the new category-based test structure: - parameters/header/nilcheck/ (prefer-skip-optional-pointer header array) - parameters/cookie/nilcheck/ (prefer-skip-optional-pointer cookie array) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
6368d27 to
bcf95c1
Compare
Replace the organically-grown test directory structure (issue-numbered directories, flat parameter/component tests) with a feature-based taxonomy that makes coverage visible at a glance.
New structure:
components/{primitives,objects,nullable,recursive}
aggregates/{allof,anyof,oneof}
parameters/{path/{simple,label,matrix},query/{form,deep_object},
header/simple,cookie/form,content,precedence,encoding}
externalref/ (multi-package external $ref qualification)
Each directory contains a minimal OpenAPI spec exercising one feature, a config.yaml, a doc.go with go:generate, committed generated code, and round-trip tests that instantiate types and verify JSON marshaling.
Key changes: