Prism saying it's violating the OpenAPI spec it's mocking

I’m just starting to play around with Prism, so I’m not sure if the behavior I’m seeing is expected but I would think it’s not. I’m spinning up a mock server using the PetStore spec file found in the examples folder of the prism repo (petstore.oas3.yaml).

If I submit ‘curl -X GET http://127.0.0.1:4010/store/order/1’ I’m getting the following response:
{
“id”: -9223372036854776000,
“petId”: -9223372036854776000,
“quantity”: -2147483648,
“shipDate”: “2020-04-10T22:06:37Z”,
“status”: “placed”,
“complete”: false
}

The mock server throws two errors:
[4:06:37 PM] » [VALIDATOR] × error Violation: response.body.id should match format “int64”
[4:06:37 PM] » [VALIDATOR] × error Violation: response.body.petId should match format “int64”

This seems odd since it seems prism is telling on itself for not following the rules. Am I missing something here?

Hey @tylerscottnielsen

you’re doing nothing wrong. This is a very interesting edge case — fundamentally JavaScript JavaScript doesn’t currently include standard support for 64-bit integer values — therefore any attempt to produce such value will fail — making the Prism validation fail.

@vncz, since this is an example from prism’s own repo, and the OpenAPI spec specifically supports specifying a int64 data type, would you consider this an issue with Prism’s implementation? Perhaps there is a way to still safely handle int64 data types in mocking?

There might be a better way to handle such situation; most likely by employing an int64 compatible library.

I would not classify this as a Prism implementation error, it’s rather runtime limitation that effectively we could overcome — the question is wether the benefits are worth the efforts.