What you will have at the end
Two Routes that refuse a request the contract does not allow, before the backend sees it. On catalog-api, request-validation holds a JSON Schema for the body and one for the headers: an order without an amount, with an amount written as text, or without the tenant header is answered 400 with a sentence you wrote. On orders-contract, oas-validator reads the OpenAPI document of the orders service: a path the document does not list, a query value outside its enum, a body missing a required property or with a wrong type is answered 400 with the engine’s own sentence naming the property, and a body that matches is created with 201. Every refusal is a request record in Traffic Explorer, answered by the gateway in 0 ms, and both Plugin additions are in the audit log.
Prerequisites
- A Route that receives JSON.
catalog-apiforwards/catalog/*to an echo service, so the article can show what the backend received; it is the Route of Caching responses with proxy-cache. - A backend with an OpenAPI document at an address the gateway can reach. The orders service of this lab serves its own,
openapi-gateway.json:GET /orderswith astatusquery parameter limited toopen,shippedandcancelled,POST /orderswith aNewOrderbody that requirescustomerandlines, andGET /orders/{orderId}. The Routeorders-contractserves/ordersand/orders/*for the hostorders.labfrom that service. - Traffic logging turned on under Traffic Explorer › Settings, and a role that may manage Routes. The screenshots below were taken as
nora.becker.
Two Plugins, two sources of truth
request-validation takes a JSON Schema you write into the Route, one for the body and one for the headers, and refuses with a status and a message you choose. oas-validator takes the OpenAPI document your API already has, written into the Route or fetched from a URL, and checks path, method, query, headers and body against it. Use the first when the contract lives in the gateway, the second when it lives in the document your Developer Portal publishes.
request-validation on catalog-api
Open the Route, Plugins, Add plugin, request-validation. The form has two editors and the refusal settings; the note on top says at least one of the two schemas is required.
- Body schema: a JSON Schema the body must match. The article’s one requires
customer, a string of at least three characters, andamount, an integer of at least 1, and limitscurrencytoEUR,USDandTRY. The editor checks the schema while you type and says so under it: valid JSON, matches the field’s schema. - Header schema, under More: a JSON Schema the headers are read against. The note under it is the one to read before writing one: a header reaches the schema as text, so a property typed as a number never matches, and a header sent twice arrives as a list. The article requires
x-tenantwith at least three characters. - Rejected code: 400. Rejected message: the whole body of the refusal, here
The order does not match the contract: customer (3+ characters) and amount (a whole number of 1 or more) are required.The note says what an empty message means: the client gets the validator’s own sentence, which names the properties the schemas carry. One message serves every refusal, the header one included, so write it for both or leave it empty. - Request body limit: bytes of the body read into memory before the schema is applied; a longer body is refused with the code above.
- The banner on top of the form, two settings edited as JSON, names the two schemas: they are the fields the editors draw, not free text.


Select Add plugin. Five requests, the body of the first one matching:
### valid body, x-tenant: acme
HTTP/1.1 200 OK
backend echoed: {'amount': 1250, 'currency': 'EUR', 'customer': 'ACME GmbH'}
### amount missing
HTTP/1.1 400 Bad Request
The order does not match the contract: customer (3+ characters) and amount (a whole number of 1 or more) are required.
### amount as text, currency not in the list
HTTP/1.1 400 Bad Request
The order does not match the contract: customer (3+ characters) and amount (a whole number of 1 or more) are required.
### not JSON at all
HTTP/1.1 400 Bad Request
The order does not match the contract: customer (3+ characters) and amount (a whole number of 1 or more) are required.
### valid body, no x-tenant header
HTTP/1.1 400 Bad Request
The order does not match the contract: customer (3+ characters) and amount (a whole number of 1 or more) are required.
The backend echoed the one request that passed and never saw the other four.

What the audit log keeps
Adding the Plugin is a Route update: who, when, which Route, and the request-validation block as the difference, with the whole body schema, the rejected code and the rejected message on the after side. The Plugin holds no secret, so nothing is masked.

oas-validator on orders-contract
Open the Route, Plugins, Add plugin, oas-validator. Under Basics, choose where the document comes from: Written here keeps the OpenAPI document in the Route’s configuration; Fetched from a URL reads it from an address the gateway can reach. The article fetches it: Document URL http://orders-svc:8080/openapi-gateway.json, the backend’s own copy. Headers sent with the fetch, further down, carries an Authorization for a document behind a login, stored on the engine and shown only to roles that manage the Route; Timeout and SSL verify apply to the fetch alone.
Under Behavior:
- Refuse a request the document does not allow stays on. The note says what off means: the request is sent to the upstream anyway and the status below is never used, which turns the Plugin into a way of finding out what would be refused before you refuse it.
- Rejection status code: 400 unless you set another, between 400 and 599.
- Four Skip switches leave out body, header, query parameter or path parameter validation, all off here.
- Say why the request was refused: on, so the refusal names the parameter or property that failed; off, it only says the request did not validate.

Select Add plugin. Two things about the document itself were measured on this install, and both matter before the first request:
- The
serversentry decides whether anything matches. The document the backend first served named its own host underservers, and every request was refused withno matching operation found, because the paths of the document were read under that server and the gateway’s requests arrive under another. A document whoseserversis[{"url": "/"}], or one that names the gateway’s own address, matches; the copy the article uses says/. - The fetched document is cached per worker process, for the time set in the plugin’s metadata, as the field’s help line says. Workers that fetched the first version of the document kept answering from it half an hour after the backend had been corrected, while workers that fetched later held the new one, so the same request was refused by one worker and passed by the next. A new address is a new cache entry: the URL was changed to
openapi-gateway.json?v=2, every worker fetched again at once, and from then on every worker answered alike. Change the version in the URL whenever you change the document.
Seven requests to orders.lab:
### GET /orders/ord-10421, a documented path with its path parameter
HTTP/1.1 200 OK
{"id":"ord-10421","customer":"cust-8831","status":"open","total":249.90,"currency":"EUR",…}
### GET /orders?status=open, the documented query parameter
HTTP/1.1 200 OK
[{"id":"ord-10421","customer":"cust-8831","status":"open",…
### GET /orders?status=everything, a value the enum does not allow
HTTP/1.1 400 Bad Request
{"message":"failed to validate request. query parameter 'status': matches none of the enum values"}
### GET /orders/ord-10421/history, a path the document does not list
HTTP/1.1 400 Bad Request
{"message":"failed to validate request. no matching operation found for GET /orders/ord-10421/history"}
### POST /orders without lines, which NewOrder requires
HTTP/1.1 400 Bad Request
{"message":"failed to validate request. body: property \"lines\" is required"}
### POST /orders with quantity as text
HTTP/1.1 400 Bad Request
{"message":"failed to validate request. body: property \"lines\" validation failed: failed to validate item 1: property \"quantity\" validation failed: wrong type: expected integer, got string"}
### POST /orders that matches NewOrder
HTTP/1.1 201 Created
{"id":"ord-10422","customer":"","status":"open","total":0,"currency":"EUR","created_at":"2026-10-13T09:12:00Z"}
Each refusal names what failed, because Say why is on; with it off, a client gets the status and a sentence that says only that the request did not validate, which is the setting for an API whose document is not public. A DELETE on the same path was answered 404 by the gateway before any Plugin ran, because the Route lists GET and POST only; a method the Route does not carry never reaches the document.

Adding oas-validator and changing its URL are Route updates in the audit log, each with the Plugin block as the difference, like the record above.
What to do next
- Put an identity in front of the contract, so that a refused body is counted against the Consumer who sent it: OAuth 2.0 access tokens at the gateway and Rate limiting per Consumer.
- The other contract on
catalog-apiis the mask list: Masking tokens and card numbers; and a transcoded gRPC call takes the same JSON contract: gRPC transcoding and WebSocket Routes. - Keep one document for both readers: the gateway that refuses by it and the people who call the API through the Developer Portal.
- The validation Plugins side by side are in the capabilities reference and on API Security; the solution page is API security and identity.