I am trying to understand how the Request Processing / Validate API Specification / Schema policy can protect / prevent a client from sending in the POST request body unexpected entries. That is, if a client will place an entry which is forbidden by the swagger/open API schema, the API GateWay should block the request, if the Validate API Specification / Schema policy is ON.
I created an API based on https://petstore.swagger.io/v2/swagger.json and I altered the POST Pet schema definition, to my best knowledge to prohibit additional entries to the body.
The steps:
create an API using https://petstore.swagger.io/v2/swagger.json after adding “additionalProperties”: false to the schema Pet resource to prevent a client to add entries to the body when sending “Pet” requests.
validate that API is created and properly works through API GW by invoking POST Pet through postman.
Add Request Processing / Validate API Specification / Schema policy to the API.
change in body “id”: 325, to “id”: “325”, (int → string) and observe API GW blocks request as expected.
change back to “id”: 325, and add “NEW_UNEXPECTED_ENTRY” : “YES”, to the body. API GW DOES NOT BLOCK the request.
Hi @Aviv.Simionovici_emp In your JSON schema enforce the additionalProperties = false. And also make sure are you in the latest fix in 10.15 its addressed in fix YAI-28224
in this ticket, I attached the json API definition which includes the “additionalProperties”: false, at the correct place + the POST PET request that is not blocked by API schema validation policy.