-
-
Notifications
You must be signed in to change notification settings - Fork 44
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
feature: stable as_json
#310
Comments
Ouch 😅 Yes that's a good idea, we can probably use |
@pawamoy I was using sort_keys, but then the order of the members would change too, not sure why :D |
Ah 🤔 I'll investigate. Members order should definitely stay the same. Unless you're using dynamic analysis and |
Can you tell me (again? sorry if I forgot) how you dump and reload the data? Or just point me at the code you're using to dump/load? |
I can't replicate the members dis-ordering issue across multiple invocations of Griffe 🤔 |
Note that members are dumped in the order they are found in the sources. If you move objects around, the order in the JSON dump will also change 🙂 Maybe we shouldn't do that and sort alphabetically instead, since we either:
By the way this source ordering is completely implicit and relies on default ordering of Python dicts since Python 3.7 (I think it's 3.7). And if we don't need the initial, implicit order of members, maybe we can even stop using a list and use a dict when dumping them instead 🤷 That would by the way make the JSON more readable (for example, no need to expand an item in Firefox to see the member's name, all names would be displayed right there in the tree without having to expand anything). |
…ata in preparation of v1 Issue-310: #310
Hi there! I have not investigated this much, but looks like using
as_json
doesn't always return the same data (or at least not in the same order) see this diff: strawberry-graphql/strawberry.rocks@fc70f2aFor my use case I'll do some sorting, but I was wondering if this could be a feature of Griffe 😊
The text was updated successfully, but these errors were encountered: