Class LoadScenarioFromOpenAPI
LoadScenario from an OpenAPI specification.
One LoadStep is emitted per operation (in the stable, path-then-method order produced
by OpenAPISerialiser.retrieveOperations(OpenAPI, String, String)), each carrying a concrete
HttpRequest with the operation's method and (server-prefixed) path, a representative request
body example (built from the request-body schema via ExampleBuilder,
the same engine the OpenAPI expectation converter uses) and a Content-Type header.
Target precedence for where each generated request is sent (carried as the request's
Host header and secure flag, the same routing surface every other load step uses):
- an explicit
LoadScenarioFromOpenAPI.Targetsupplied by the caller, else - the spec's
servers[0]URL (host, port andhttpsscheme), else - nothing — the request is left path-only and the operator edits in a target before running.
When the caller supplies no LoadProfile a conservative default is applied — a single
short constant-VU stage — so the generated scenario is immediately runnable yet safe; the operator
is expected to edit the profile afterward. Steps are plain and ordered (no weighting in v1).
This is a pure generator: it produces a LoadScenario object and drives no traffic.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAn explicit network target for the generated steps. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic LoadScenariogenerate(String name, String specUrlOrPayload, LoadScenarioFromOpenAPI.Target target, LoadProfile profile, MockServerLogger mockServerLogger) Generates aLoadScenariofrom an OpenAPI spec.
-
Constructor Details
-
LoadScenarioFromOpenAPI
public LoadScenarioFromOpenAPI()
-
-
Method Details
-
generate
public static LoadScenario generate(String name, String specUrlOrPayload, LoadScenarioFromOpenAPI.Target target, LoadProfile profile, MockServerLogger mockServerLogger) Generates aLoadScenariofrom an OpenAPI spec.- Parameters:
name- the generated scenario namespecUrlOrPayload- the OpenAPI spec as an inline JSON/YAML payload, URL or file/classpath reference (accepted identically toPUT /mockserver/openapi/expectation)target- explicit network target (may be null — see class-level precedence)profile- explicit load profile (may be null — a conservative default is applied)mockServerLogger- logger used by the shared OpenAPI parse- Returns:
- the generated, editable
LoadScenario - Throws:
IllegalArgumentException- if the spec cannot be parsed or contains no operations
-