Package org.forgerock.openig.handler
Class MockDataGenerator
- java.lang.Object
-
- org.forgerock.openig.handler.MockDataGenerator
-
public class MockDataGenerator extends Object
Generates realistic mock values for OpenAPI schema properties.Values are chosen using the following priority order:
- Schema
format(date, date-time, email, uri, uuid, ipv4, hostname, byte, password, …) - Field-name heuristic powered by Datafaker (case-insensitive, separator-agnostic lookup)
- Schema
typefallback (generic string / integer / number / boolean)
The generator uses a seeded
Fakerso results are deterministic and reproducible across test runs.Numeric and string constraints (
minimum,maximum,minLength,maxLength) are respected when present. - Schema
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Objectgenerate(String fieldName, io.swagger.v3.oas.models.media.Schema<?> schema)Generates a realistic mock value for the given field name and schema.
-
-
-
Method Detail
-
generate
public static Object generate(String fieldName, io.swagger.v3.oas.models.media.Schema<?> schema)
Generates a realistic mock value for the given field name and schema.- Parameters:
fieldName- the property name (may benullfor anonymous/array items)schema- the OpenAPI schema for this field- Returns:
- a mock value compatible with the schema type
-
-