SchemaExampleValueGeneratorOptions

data class SchemaExampleValueGeneratorOptions(val maxExampleDepth: Int = DEFAULT_MAX_EXAMPLE_DEPTH, val includeOptionalExampleProperties: Boolean = DEFAULT_INCLUDE_OPTIONAL_EXAMPLES, val includeWriteOnly: Boolean = DEFAULT_INCLUDE_WRITE_ONLY, val useSchemaExampleFallback: Boolean = DEFAULT_USE_SCHEMA_EXAMPLE_FALLBACK, val fullExample: Boolean = DEFAULT_FULL_EXAMPLE)

Configuration options for SchemaExampleValueGenerator.

Controls the behavior of example value generation from OpenAPI schemas.

Java callers: start from REQUEST_DEFAULTS or RESPONSE_DEFAULTS and adjust via the with* methods instead of the positional constructor:

var options = SchemaExampleValueGeneratorOptions.RESPONSE_DEFAULTS.withFullExample(true);

Note: when a generator is used through the ResponseExampleExtractor(SchemaExampleValueGenerator) constructor, response extraction applies RESPONSE_DEFAULTS for the include/fallback flags and only honors maxExampleDepth and fullExample from the configured options.

Constructors

Link copied to clipboard
constructor(maxExampleDepth: Int = DEFAULT_MAX_EXAMPLE_DEPTH, includeOptionalExampleProperties: Boolean = DEFAULT_INCLUDE_OPTIONAL_EXAMPLES, includeWriteOnly: Boolean = DEFAULT_INCLUDE_WRITE_ONLY, useSchemaExampleFallback: Boolean = DEFAULT_USE_SCHEMA_EXAMPLE_FALLBACK, fullExample: Boolean = DEFAULT_FULL_EXAMPLE)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

When true, generates a complete example: every declared property (required and optional, regardless of explicit examples) is populated, and every array contains at least one item. For composed schemas (oneOf/anyOf), a single variant is produced. includeWriteOnly and depth/cycle guards still apply.

Link copied to clipboard

When true, includes optional properties that have explicit examples

Link copied to clipboard

When false, excludes writeOnly properties (appropriate for response examples)

Link copied to clipboard

Maximum depth for recursive schema traversal (default: 50)

Link copied to clipboard

When true, falls back to schema.examples and schema.default if no example found

Functions

Link copied to clipboard

Returns a copy with fullExample replaced. Java-friendly alternative to copy.

Link copied to clipboard

Returns a copy with includeOptionalExampleProperties replaced. Java-friendly alternative to copy.

Link copied to clipboard

Returns a copy with includeWriteOnly replaced. Java-friendly alternative to copy.

Link copied to clipboard

Returns a copy with maxExampleDepth replaced. Java-friendly alternative to copy.

Link copied to clipboard

Returns a copy with useSchemaExampleFallback replaced. Java-friendly alternative to copy.