GwentAPI / gwentapi

The code for GwentAPI
https://gwentapi.com
BSD 3-Clause "New" or "Revised" License
47 stars 1 forks source link

Some cards are missing certain properties #33

Closed zhouzi closed 7 years ago

zhouzi commented 7 years ago

That may be intentional but some cards doesn't have certain properties. For example, Alba Spearmen doesn't have categories although Adrenaline Rush does.

I'd suggest to set it to an empty array instead of removing it.

Tri125 commented 7 years ago

It's intended and documented.

faction, group, href, name, uuid, and variations are guaranteed to be part of the object, the rest are optional.

I don't think there's a strong semantic reason to make an empty array, I think it communicate the same intention if it's missing entirely.

If there's not a strong semantic reason I leave out the field since it would otherwise use memory and consume a tiny bit more bandwidth to create the object for 0 benefit.

Tri125 commented 7 years ago

This is, of course, up for discussion.

zhouzi commented 7 years ago

Having default empty values makes it easier to consume as you can loop over the cards and treat them all the same. But it's no big deal and I'm fine with it 👍