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

How to stabilize output of Schema#toString() #475

Open
dims12 opened this issue Jan 5, 2023 · 1 comment
Open

How to stabilize output of Schema#toString() #475

dims12 opened this issue Jan 5, 2023 · 1 comment

Comments

@dims12
Copy link

dims12 commented Jan 5, 2023

In my experience, an output of Schema#toString() can be different for equal objects. Particularly, order of dictionary keys can be different.

Can this be stabilized?

Or is it possible to use other method to convert Schema to String to get stable results?

@erosb
Copy link
Contributor

erosb commented Jan 5, 2023

Hello, no, that's not possible, because internally the library uses the https://github.com/stleary/JSON-Java library, in which JSONObject is internally represented with a HashMap, which doesn't guarantee ordering of keys.

I suggest looking into https://github.com/skyscreamer/JSONassert which can solve this json comparison problem in tests (at least).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants