ajv-validator / ajv-validator/ajv-formats

int64 validation is incorrect

Open
#90 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
228
Forks
42
PR merge metrics
No merged PRs in 30d

Description

https://github.com/ajv-validator/ajv-formats/blob/4dd65447575b35d0187c6b125383366969e6267e/src/formats.ts#L252

> // JSON and javascript max Int is 2**53, so any int that passes isInteger is valid for Int64

The second part of the sentence does not follow from the first. Neither JS nor JSON do not throw on overflows.

Consider this:

```
> Number.isInteger(JSON.parse('' + (2 ** 65)))
true
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.