Open Magicking opened 4 years ago
JSON doesn't support hexadecimal notation. Also this number is far too big to be represented accurately in JSON.
I don't understand what JSON has to do with the problem I'm pointing.
The problem is that it converts the hexadecimal to a number where it should stay as a string (and not try to convert something without knowing what's the underlying type) as per the specification https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#data-types « Tools that do not recognize a specific format MAY default back to the type alone, as if the format is not specified. »
The schema editor is for JSON Schema, that's what it's got to do with JSON.
The quote you pulled from the specification has to do with validating schemas based on the format
keyword. That's irrelevant here.
Ok, I think I was not clear in my explication.
Here, what's work https://imgur.com/r7U467y , you can see that the format is string
and the example
is a string as well (by the way, this should not be valid as pattern is not respected)
And where you enter this https://imgur.com/A5CgF9B and hit enter, the 0x... get converted to a number
instead of staying as string
as you can see here https://imgur.com/pZAJsAP
by the way, this should not be valid as pattern is not respected
There is nothing stopping you writing JSON Schemas which have contradictions. The component is an editor, not a JSON Schema validator.
If you think the handling of numeric entry for insanely large numbers is incorrect, the repo is here: https://github.com/josdejong/jsoneditor
Fair point, thank you! I'll see over there.
The same behavior can't be reproduced in the latest version of the jsoneditor over at https://jsoneditoronline.org/ and the version of jsoneditor embedded is 3 years old, I guess the issue lies somewhere between the 5.7.2 and the latest 9.0.3 version!
Ok, let me look at how much work it is to update the dependency. Thanks.
Can you try now and see if the issue is resolved?
The issue is not solved, the editor is way better though but I still need to add an extra _
to my example
property if it's a hex string
When entering a hexadecimal (e.g: 0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a) string in the schema editor in the value, it get converted to a number « 2.264731349119913e+115 » instead of sticking to the hexadecimal reprensation.