Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hexadecimal interpreted as number #61

Open
Magicking opened this issue May 30, 2020 · 10 comments
Open

Hexadecimal interpreted as number #61

Magicking opened this issue May 30, 2020 · 10 comments
Labels
bug dependencies Pull requests that update a dependency file help wanted

Comments

@Magicking
Copy link

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.

@MikeRalphson
Copy link
Contributor

JSON doesn't support hexadecimal notation. Also this number is far too big to be represented accurately in JSON.

@Magicking
Copy link
Author

Magicking commented Jul 22, 2020

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. »

@MikeRalphson
Copy link
Contributor

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.

@Magicking
Copy link
Author

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

@MikeRalphson
Copy link
Contributor

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

@Magicking
Copy link
Author

Fair point, thank you! I'll see over there.

@Magicking
Copy link
Author

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!

@MikeRalphson
Copy link
Contributor

Ok, let me look at how much work it is to update the dependency. Thanks.

@MikeRalphson MikeRalphson reopened this Jul 23, 2020
@MikeRalphson MikeRalphson added bug dependencies Pull requests that update a dependency file and removed wontfix labels Jul 23, 2020
MikeRalphson added a commit that referenced this issue Jul 23, 2020
Squashed commit of the following:

commit 783c21aa1fe66791fbe9eb88a28f147305b97b2f
Author: Mike Ralphson <[email protected]>
Date:   Thu Jul 23 11:20:43 2020 +0100
@MikeRalphson
Copy link
Contributor

Can you try now and see if the issue is resolved?

@Magicking
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug dependencies Pull requests that update a dependency file help wanted
Projects
None yet
Development

No branches or pull requests

2 participants