Closed KingSupernova31 closed 5 years ago
They were manually done before. We might fix that up, but honestly ordering is not really guaranteed in JSON
Whether or not an array or object in JSON has ordering semantics depends entirely on the specification, which in our case is https://mtgjson.com/v4/docs.html. I've checked the docs for "names"
however and you're correct that the field currently specifies no order. That is a severe feature loss compared to version 3, and guaranteed order should be reintroduced. From the v3 docs:
For meld cards, the first name is the card with the meld ability, which has the top half on its back, the second name is the card with the reminder text, and the third name is the melded back face.
We should also document the order for split, flip, and double-faced cards while we're at it.
I could agree with defining an ordering. I will need a bit of time to get this right, however. At the latest, this will be in 4.1
There needs to be some way to tell which part of a multi-part card is which. A guaranteed ordering of "names" is the simplest way to do that, and is consistent with v3.
@ZeldaZach do you have milestones, projects or tags setup for this purpose? So that things like boosters and this issue are planned for 4.1
?
@fenhl So we could say for the array of cards we define that the first element always will be "name" of the card? And don't start it with artist in alphabetical ordering? That would make looking at the file manually way way easier and convenient!
Yes, that is possible in the JSON format. To support this, we would have to:
collections.OrderedDict
s instead of dict
s for card objects,json.dump
/json.dumps
is called without the sort_keys=True
flag, and@fenhl That's a bit of work to accomplish, and I'm not sure if I have the time to do such a thing right now... Would be open to a refactor of the project to allow for such a solution
The "names" array on all multi-part cards is the only way to tell which part is which, and as such its order is important. For meld cards, the order should be: top half, bottom half, melded card. This is the intuitive order, and is the way it was done in v3. Currently however the names arrays on the meld cards are in a seemingly random order, not even consistent among themselves.