Overview of the OpenAPI mock API type and two-way mock generation
path-method-status-contentType
, existing stubs will be updated if any of the following apply:
path-method-status-contentType
which shares the response body with the existing stub.path-method-status-contentType
only provides a single example.path-method-status-contentType
doesn’t provide examples at all./orders
to /v1/orders
the path
will be classed as a new path and a new stub will be created. The old stub will not be deleted.
If you are modeling new data scenarios and you add new stubs to your Mock API after generating stubs from an OpenAPI
specification, these stubs will not always be updated when you update your OpenAPI specification. If those new stubs
do not match an example in your OpenAPI specification, they will not be updated when you update your OpenAPI specification
(adding a new parameter for example) and you will need to update those manually.
304
response:
If-None-Match
with specific value 12345
.422
response:
400
response:
x-parameter-values
is provided (as explained here), in which case it will be used to generate the expected values of the parameter matchers.required: true
then the stub will be generated
or updated with that parameter. WireMock cloud add a value for that parameter to match on. You can control the value
generated in your stubs using various OpenAPI elements:
If no min or max length are provided in the schema, defaults of a minimum of 3 and a maximum of
200 is used. Therefore, an OpenApi specification snippet like the following:
tripId
equalsTo matcher with the following value - gtpq1fggnuolb31tya6rrc1tye1am5bkzw5kjxxeyscx9lb3zhla
Adding a minLength
and a maxLength
to the schema will control the size of the random string. The snippet below:
tripId
equalsTo matcher with the following value - aspp
You can force a value to be used in the matcher by creating an enum with only one value. This is effectively the same as
generating a constant
tripId
equalsTo matcher with the following value - trip-id-68975013
.
Optional minLength
and maxLength
elements can be used to further control the generated value:
tripId
equalsTo matcher with the following value - trip-id-6
.