·
0 commits
to ca6e854e01fd8e4585b94e39a12768205a9ec3d6
since this release
π swagger-coverage-cli v8.0.2
β¨ New Features
- π Folder-Level Tests Support: Tests defined at folder level in Postman collections are now automatically applied to all requests within that folder
- π Recursive Test Inheritance: Support for nested folder hierarchies with test inheritance across multiple levels
- π‘οΈ Flexible Spec Validation: New
--disable-spec-validationflag to process specs with validation or reference issues
π¨ Enhanced Features
- Better Coverage Calculation: More accurate coverage metrics by including folder-level test assertions
- Reduced Test Duplication: Define common tests once at folder level instead of repeating on every request
- Enterprise Collection Support: Improved support for well-organized Postman collections with folder structures
- Legacy API Support: Work with incomplete or invalid specs using
--disable-spec-validation
π Folder-Level Tests
Postman collections organized into folders can now have tests defined at the folder level that automatically apply to all child requests:
{
"name": "User API",
"item": [
{ "name": "Get Users", "request": {...} },
{ "name": "Create User", "request": {...} }
],
"event": [{
"listen": "test",
"script": {
"exec": ["pm.expect(pm.response.code).to.be.oneOf([200, 201]);"]
}
}]
}Benefits:
- β Both requests inherit status codes 200 and 201 from folder
- β Folder tests combine with request-level tests
- β Supports unlimited nesting depth
- β Backward compatible with existing collections
π‘οΈ Spec Validation Control
The new --disable-spec-validation flag allows you to analyze coverage even when specs have validation issues:
# Skip validation for specs with broken references or validation errors
swagger-coverage-cli api.yaml collection.json --disable-spec-validationUse cases:
- Legacy APIs with incomplete specifications
- Specs with external references that can't be resolved
- APIs in development where specs aren't fully complete
- Quick coverage checks without fixing all spec issues first
π― Protocol Support
π REST/OpenAPI
- OpenAPI v2/v3 specifications (YAML/JSON)
- Smart path matching with parameter variations
- Request body and query parameter validation
- Multiple status codes per operation
β‘ gRPC
- Protocol Buffer (.proto) file parsing
- Service and method extraction
- HTTP/2 path mapping (/package.service/method)
- Content-type validation (application/grpc)
π GraphQL
- GraphQL schema (.graphql/.gql) parsing
- Query, mutation, and subscription extraction
- Type system with arguments and unions
- Unified /graphql endpoint handling
π Usage Examples
# Single protocol APIs
swagger-coverage-cli api.yaml collection.json # OpenAPI/REST
swagger-coverage-cli service.proto collection.json # gRPC
swagger-coverage-cli schema.graphql collection.json # GraphQL
# Mixed protocol APIs (Enterprise-ready)
swagger-coverage-cli "api.yaml,service.proto,schema.graphql" collection.json
# All existing options work across protocols
swagger-coverage-cli "api.yaml,service.proto" collection.json --verbose --strict-bodyπ§ Compatibility
- β Maintains backwards compatibility with existing workflows
- β Node.js 14+ required
- β NPM package available globally
- β Smart mapping enabled by default
- β All existing CLI options work with new protocols
π¦ Installation
npm install -g swagger-coverage-cli@8.0.2π§ͺ Quality Assurance
- 198 Tests: Comprehensive test suite covering all protocols, scenarios, folder-level tests, and spec validation control
- 22 Test Suites: Dedicated test coverage for each protocol, integration scenarios, validation features, and edge cases
- Folder Tests Coverage: 18 tests specifically for folder-level test extraction including deep nesting, empty folders, and mixed patterns
- Edge Case Coverage: Robust handling of malformed URLs, missing data, broken references, complex scenarios, and various Postman collection structures
- Performance Tested: Validated with large datasets, mixed protocol specifications, and deeply nested folder hierarchies
- Protocol Isolation: Each protocol's parsing and matching logic is independently tested
- Validation Testing: Comprehensive tests for
--disable-spec-validationflag covering unit and CLI integration
Full Changelog: v1.0.0...v8.0.2