Skip to content

Budget controls

OpenAPI schemas can be deeply nested or contain combinatorial compositions (allOf/anyOf/oneOf). Budget controls cap worst-case behavior and keep generation tractable.

Key budgets

Budget Default Description
maxSchemaDepth 50 Recursion limit when traversing schemas for validation
maxMergedSchemaDepth 50 Recursion limit when merging composed schemas into a flattened view
maxSchemaCombinations 100 Cap on composed-schema combinations (prevents anyOf/oneOf explosion)
maxTestCasesPerOperation 1000 Maximum test cases generated for a single operation
maxErrors 100 Cap on collected errors when using COLLECT_ALL mode

What happens when a budget is exceeded

Some budget violations are converted into structured generation errors (via provider boundaries), while others may stop generation for a specific operation depending on where the limit is enforced.

When a budget is exceeded, the error includes:

  • The operation path and method
  • The current count vs. the limit
  • Suggested solutions (increase limit, simplify schema, or use ignore rules)

How to tune budgets

  • Increase budgets when your schemas are legitimately complex and you need more coverage.
  • Decrease budgets in CI when you prefer faster feedback.
  • Consider using ignore rules for problematic operations instead of globally increasing limits.

Configuration examples

CLI:

openapi-testgen \
  --setting testGenerationSettings.maxSchemaDepth=100 \
  --setting testGenerationSettings.maxTestCasesPerOperation=500 \
  --spec-file openapi.yaml

Gradle:

openApiTestGenerator {
    testGenerationSettings {
        maxSchemaDepth.set(100)
        maxTestCasesPerOperation.set(500)
    }
}

YAML config:

testGenerationSettings:
  maxSchemaDepth: 100
  maxTestCasesPerOperation: 500