Closed s-h-a-d-o-w closed 10 months ago
I just tried to trace this problem myself and realized that it seems all you're doing is using JSON.parse
: https://github.com/APIDevTools/json-schema-ref-parser/blob/main/lib/parsers/json.ts#L38
So I compared and... the result matches. Strange but I guess the problem actually lies somewhere here: https://chromium.googlesource.com/v8/v8.git/+/refs/heads/main/src/json/json-parser.cc
If someone stumbles across this - there's no problem.
The number changes because it's larger than the max safe integer in JS. And when it comes to the text change - I didn't escape the backslash. 🙈
My source file (I converted the original spec to v3 and fixed an invalid regex): https://gist.github.com/s-h-a-d-o-w/1e6ddd918d93181473883ecd8375d85d
Doing
await SwaggerParser.parse("./docker.json")
results in the following:While the escape character removal fortunately doesn't happen in the actual pattern when it comes to the first problem, I tried changing from
example
todefault
and the number is changed in that case as well!