Axway-API-Management-Plus / openapi-validator

Validates request and response based on the OpenAPI specification
Apache License 2.0
3 stars 1 forks source link

Failed to validate API-Request using a path parameter #1

Closed cwiechmann closed 2 years ago

cwiechmann commented 2 years ago

When having an API using a path parameter like the following request from the Petstore:

GET http://api.customer.com/v2/store/order/123456

The validation fails with the following error message:

Instance type (string) does not match any allowed primitive type (allowed: ["integer"])

The is because the current Javascript-Code example is using the variable:

def path = msg.get("api.method.path");

which doesn't contain the resolved path (/v2/store/order/123456) and instead the specified API-Method (e.g. /store/order/{orderId}). And as {orderId} is clearly a string the validation fails.