You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 12, 2026. It is now read-only.
Product Requirements Document: OpenAPI Test Generation
Overview
Feature Name: OpenAPI Test Generation Version: 1.0 Target Release: Next minor version Owner: Manny
Summary
Enable Doc Detective to automatically generate HTTP API tests from OpenAPI 3.x specifications provided as direct input files. This feature transforms OpenAPI definitions into executable test specifications that leverage Doc Detective's existing httpRequest action capabilities.
Background & Motivation
Currently, Doc Detective can reference OpenAPI definitions for individual httpRequest steps, but cannot automatically generate comprehensive test suites from OpenAPI specifications. This manual process limits test coverage and requires significant developer effort to maintain API tests as specifications evolve.
By automatically generating tests from OpenAPI definitions, teams can:
Achieve comprehensive API test coverage with minimal manual effort
Maintain test synchronization with API specification changes
Leverage contract testing for API validation
Reduce time-to-market for API testing initiatives
Goals & Success Criteria
Primary Goals
Automatic Test Generation: Transform OpenAPI 3.x files into executable Doc Detective test specifications
Safety-First Approach: Only generate tests for operations deemed safe to execute automatically
Dependency Management: Support operation dependencies through x-doc-detective extensions
Seamless Integration: Work within existing Doc Detective detection and resolution workflows
Success Criteria
OpenAPI 3.x files can be provided as direct input to doc-detective command
Generated tests execute successfully against live APIs
Tests leverage all existing Doc Detective httpRequest capabilities
Zero breaking changes to existing functionality
User Stories
Primary User Stories
As an API developer, I want to provide my OpenAPI spec as input to Doc Detective so that comprehensive API tests are automatically generated
As a QA engineer, I want unsafe operations (PUT/DELETE) to require explicit configuration so that automated tests don't accidentally modify production data
As a DevOps engineer, I want dependency management between API operations so that complex test scenarios (create → read → delete) can be automated
Secondary User Stories
As an API maintainer, I want root-level defaults in my OpenAPI spec so that common configuration applies to all operations
As a test author, I want operation-level overrides so that specific endpoints can have custom test behavior
Functional Requirements
Core Functionality
FR-1: OpenAPI File Detection
Requirement: Detect OpenAPI 3.x files in input parameter
Acceptance Criteria:
Files with .json, .yaml, .yml extensions containing valid OpenAPI 3.x structure are identified
Product Requirements Document: OpenAPI Test Generation
Overview
Feature Name: OpenAPI Test Generation
Version: 1.0
Target Release: Next minor version
Owner: Manny
Summary
Enable Doc Detective to automatically generate HTTP API tests from OpenAPI 3.x specifications provided as direct input files. This feature transforms OpenAPI definitions into executable test specifications that leverage Doc Detective's existing
httpRequestaction capabilities.Background & Motivation
Currently, Doc Detective can reference OpenAPI definitions for individual
httpRequeststeps, but cannot automatically generate comprehensive test suites from OpenAPI specifications. This manual process limits test coverage and requires significant developer effort to maintain API tests as specifications evolve.By automatically generating tests from OpenAPI definitions, teams can:
Goals & Success Criteria
Primary Goals
x-doc-detectiveextensionsSuccess Criteria
doc-detectivecommandhttpRequestcapabilitiesUser Stories
Primary User Stories
Secondary User Stories
Functional Requirements
Core Functionality
FR-1: OpenAPI File Detection
inputparameter.json,.yaml,.ymlextensions containing valid OpenAPI 3.x structure are identifiedfileTypesvalidationFR-2: Automatic Test Generation
testIdhttpRequestaction withopenApi.operationIdreferencesummaryordescriptionopenApiarrayFR-3: Operation Safety Classification
FR-4: Extension Property Support
x-doc-detectiveextension for operation configurationx-doc-detectiveaccepted at OpenAPI root level (defaults for all operations)x-doc-detectiveaccepted at operation level (overrides root defaults)safeboolean property to override default safety classificationbeforearray for prerequisite operationsafterarray for cleanup operationsopenApischema properties:server,validateSchema,mockResponse,statusCodes,useExample,exampleKey,requestHeaders,responseHeadersFR-5: Dependency Management
beforeoperations are added as steps before main operationafteroperations are added as steps after main operationoperationIdORpath+methodcombinationbeforeoperations automatically propagate to subsequent stepsIntegration Requirements
FR-6: Workflow Integration
parseTests()function withinutils.jsresolveTests()or execution logicFR-7: Configuration Inheritance
loadDescription()function used for OpenAPI dereferencingTechnical Requirements
TR-1: File Processing
isValidSourceFile()to identify OpenAPI 3.x filesisOpenApi3File()helper function for OpenAPI detectionparseTests()to handle OpenAPI transformationTR-2: Code Organization
openapi.js:transformOpenApiToSpec()extractOperations()transformOperationToTest()createHttpRequestStep()createDependencySteps()isOperationSafe()findOperationById()findOperationByPath()TR-3: Error Handling
TR-4: Performance Considerations
Non-Functional Requirements
NFR-1: Backward Compatibility
NFR-2: Maintainability
NFR-3: Extensibility
Implementation Phases
Phase 1: Core Implementation
isValidSourceFile()parseTests()httpRequeststep generationPhase 2: Extension Support
x-doc-detectiveproperty parsingbefore/afteroperations)Phase 3: Polish & Testing
Testing Strategy
Unit Tests
Integration Tests
Test Data
x-doc-detectiveextensionsDependencies & Assumptions
Dependencies
loadDescription()function for OpenAPI dereferencinghttpRequestaction implementation$$response.body.*)doc-detective-commonvalidation functionsAssumptions
Documentation Requirements
User Documentation
x-doc-detectiveextension property referenceDeveloper Documentation
Success Metrics
Adoption Metrics
x-doc-detectiveextensionsQuality Metrics
Risks & Mitigations
Technical Risks
before/afteroperationsProduct Risks
Future Considerations
Potential Enhancements
Integration Opportunities