Pokeapi: Different json response for the same evolution-chain request

Created on 7 Aug 2020  路  10Comments  路  Source: PokeAPI/pokeapi

The difference seems to be caused by the slash at the end.
I haven't encountered this difference in other requests, so I guess it's not intentional.
In one response, the evolves_to is not nested like the others.

| Wrong?| Correct |
|---------|-------|
| https://pokeapi.co/api/v2/evolution-chain/1 | https://pokeapi.co/api/v2/evolution-chain/1/ |

pokeapi

Thanks

Most helpful comment

Yup, that seems to be the issue. Changing line 1281 in this function from build.py to the correct column number (18 instead of 16) fixes the issue. Should I make a pull request?

All 10 comments

You're absolutely right! Does it happen only for bulbasaur->venusaur? I'll look into it

PS: on my side, it happens always no matter the slash

Nuts, this issue is present since even before we merged https://github.com/PokeAPI/pokeapi/pull/485.

Maybe @phrasmotica, could guess something. A couple of months ago he helped us with Wurmple's evolutions. Maybe for him, it could be easy.

I did some testing @Naramsim for evolution-chain/1 between #513 and #514. I built them both to an sqlite and postgresql db.

On the sqlite db, it works as intended with evolves_to being nested, like the right hand side of the picture in @pedrorault comment. But on the postgresql db, the api endpoint returned the wrong result, the left side of the image, in #514 but the correct right side of the image in #513.

I haven't looked into the functions yet, but maybe some data in the csv's updated in #514 are causing the issue?

Also, I found an unrelated issue looking at the pokemon_species.csv in the updated Veekun data. The order variable set in this function in the build.py script is no longer set to the order column in the csv, but now the is_legendary column.
Edit: I've also noticed that evolution-chain/413 doesn't work as intended either.

Actually I think having the wrong order value I mentioned above is actually the issue for this because I think this function in the serializers.py script uses the order to sort the pokemon. I'm going to try and see if this is the cause.

Yup, that seems to be the issue. Changing line 1281 in this function from build.py to the correct column number (18 instead of 16) fixes the issue. Should I make a pull request?

Actually I think having the wrong order value I mentioned above is actually the issue for this because I think this function in the serializers.py script uses the order to sort the pokemon. I'm going to try and see if this is the cause.

Ahhh, true! I've also seen that they added some columns! If that's the issue, could you please open a PR towards our staging branch? Thanks SO much for the analysis!

I did the modification on the staging, in 50 mins staging.pokeapi.co should be updated.

Hi, @C-Garza, it works! Thanks a lot!, Fieww, you saved us a lot of hassles. Could you please then open the PR so it appears it was you that fixed the issue?

Thanks

No problem, I've made the pull request now 馃槃.

Was this page helpful?
0 / 5 - 0 ratings