You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this example, WireMock acts as a simple proxy. It forwards a request for a scorecard (with namespace: default, kind: application, name: techradar) to Prism and adds the Prefer header to techradar, which corresponds to the example name.
OpenApi 3.x response examples
/scorecards/{namespace}/{kind}/{name}:
get:
summary: Retrieve scorecard for a specific entitydescription: Get the scorecard for a specific entity identified by its kind, namespace, and name triple.operationId: getScorecardparameters:
- name: namespacein: pathdescription: Namespace of the entityrequired: trueschema:
type: stringdefault: defaultexamples:
- default
- name: kindin: pathdescription: Type of the entityrequired: trueschema:
type: stringexamples:
- application
- name: namein: pathdescription: Name of the entityrequired: trueschema:
type: stringexamples:
-
responses:
"200":
description: Scorecard for the requested entityRefcontent:
application/hal+json:
schema:
$ref: "#/components/schemas/Scorecard"examples:
sda:
$ref: "./examples/getScorecard.sda.json"techradar:
$ref: "./examples/getScorecard.techradar.json"
More complex mappings are of course easily supported. For example, utilizing Wiremock’s support for Handlebars one can:
I understand using a competitor like Wiremock might not be ideal but it works well and is relatively easy to do. Perhaps some server middleware is required to make it all easier and more natural.
Hi, we are currently using Prism to run contract tests and it would be great to have a feature where we can auto populate requests based off example values in our OAS.
If I've understood correctly WireMock is currently a workaround for this and not the ideal solution? I am happy to try and add native support for auto-populating request values inside Prism.
Would you want it to look something like this?:
You can run Prism CLI:
prism proxy --auto-populate-request (some new flag in the CLI)
And then when a request is sent to Prism, if it has any missing values in the header/body they are populated based on the examples in the Spec?
Originally posted by @jbadeau in #1838
The text was updated successfully, but these errors were encountered: