SchemaExampleValueGenerator
class SchemaExampleValueGenerator(valueProviders: List<SchemaValueProvider>, schemaMerger: SchemaMerger = SchemaMerger(), options: SchemaExampleValueGeneratorOptions = SchemaExampleValueGeneratorOptions())
Generates synthetic example values from OpenAPI schemas for use in tests.
Provider order matters: the first provider that returns a non-null value wins.
Constructors
Link copied to clipboard
constructor(valueProviders: List<SchemaValueProvider>, schemaMerger: SchemaMerger = SchemaMerger(), options: SchemaExampleValueGeneratorOptions = SchemaExampleValueGeneratorOptions())
Functions
Link copied to clipboard
Produces an example array value that satisfies array constraints.
Link copied to clipboard
fun getExampleArrayValuesByItem(name: String, arraySchema: Schema<*>, itemSchema: Schema<*>, openAPI: OpenAPI, depth: Int = 0, visitedRefs: MutableSet<String> = mutableSetOf()): List<Any>
Produces an example array value from explicit array and item schemas.
Link copied to clipboard
Generates a valid object based on the provided schema.
Link copied to clipboard
fun getExampleValue(name: String, schema: Schema<*>, openAPI: OpenAPI, variationIndex: Int = 0): Any
Retrieves the example value for a given parameter based on its schema.
Link copied to clipboard
fun getExampleValueWithOptions(name: String, schema: Schema<*>, openAPI: OpenAPI, options: SchemaExampleValueGeneratorOptions, variationIndex: Int = 0): Any
Retrieves the example value with custom options for per-call customization.