Closed mbndr closed 5 years ago
Changing the API (cmc) could cause errors in other peoples code.
What do the other users think about this?
If it is not possible to fix this easily, at least it would be a good idea to write about this issue in the README
Simple code snippet to reproduce:
package main
import (
"log"
"github.com/MagicTheGathering/mtg-sdk-go"
)
func main() {
cards, _, err := mtg.NewQuery().Page(3)
if err != nil {
log.Println(err)
}
for _, card := range cards {
log.Println(card.Name)
}
}
it seems that now the mtg api will respond with a float value for every card's cmc, triggering the error described above. Are someone experiencing this problem?
Yes you're right, I didn't test the Go sdk but in a raw json response the cmc is now a float value :+1:
Closing this issue because the problem must be handled here #4
I'm currently playing around with this SDK (good work btw) and noticed that I have a problem to query the third page of all cards. This is caused by this card: https://api.magicthegathering.io/v1/cards/c7affc1bfd16e3091541d52cad6cfd61c712b0d7
It has a
cmc
of0.5
and therefore cannot be unmarshalled touint32
. I can query all other 360 pages without this problem so I assume this is a very special attribute.I don't know if it makes sense to change the type of
Card.CMC
to something else only because of this card, however, I wanted to inform you about that issue.