Class JsonSchemaResponseSynthesizer
OpenAPIParser (so $ref, allOf, OpenAPI 3.1 type arrays
and the typed swagger Schema subclasses are produced exactly as for a real spec), and then
handed to the existing ExampleBuilder/SampleDataGenerator engine to produce a body
that respects types, required, enum, default and arrays.
No example-generation logic is reimplemented here — only the plumbing that turns a bare JSON Schema into the typed schema the engine already understands.
Trust model: the inline schema is parsed via the same OpenAPIParser used for full
OpenAPI specs, so a remote or file: $ref inside the schema is resolved (fetched) exactly
as it would be for an attached spec. This deliberately follows the OpenAPI-spec trust model — the field
is settable only via the (JWT-protectable) control plane, which already permits attaching an arbitrary
spec via specUrlOrPayload — and is not gated by the jsonSchemaAllowRemoteRefs
property that guards remote $refs on the JSON-Schema body-matching path. Treat an inline
generateFromSchema with the same trust as a specUrlOrPayload.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionsynthesizeResponse(String jsonSchema) Generates a schema-valid JSON body for the supplied inline JSON Schema.
-
Constructor Details
-
JsonSchemaResponseSynthesizer
-
-
Method Details
-
synthesizeResponse
Generates a schema-valid JSON body for the supplied inline JSON Schema.- Parameters:
jsonSchema- the inline JSON Schema (a plain JSON Schema object, not a full OpenAPI doc)- Returns:
- a schema-valid JSON body, or
nullwhen the schema is blank or no example could be generated (the caller then leaves the response body unset)
-