Can't get all evolution chains due to missing field
The generated function for evolution_chain::get_all_entries expects to get a list of NamedApiResource<EvolutionChain>, but PokeAPI doesn't give a name for evolution chains:
curl https://pokeapi.co/api/v2/evolution-chain?limit=3 | jq
outputs
{
"count": 541,
"next": "https://pokeapi.co/api/v2/evolution-chain?offset=3&limit=3",
"previous": null,
"results": [
{
"url": "https://pokeapi.co/api/v2/evolution-chain/1/"
},
{
"url": "https://pokeapi.co/api/v2/evolution-chain/2/"
},
{
"url": "https://pokeapi.co/api/v2/evolution-chain/3/"
},
]
}
Which causes reqwest to return a decode error for the missing name field
Hello @AnActualEmerald ! Thanks for using rustemon and for reaching out ! Good catch !
I reproduced the error. I also looked at PokeAPI docs and the evolution_chain::get_all_entries function do respect the specs under Resource Lists/Pagination at https://pokeapi.co/docs/v2.
So if I'm not missing something here, it looks like there a delta between PokeAPI format and the actual data send.
I think PokeAPI should resolve this first and then rustemon should be modified if needed.
Do you want to handle this or you rather prefer me to contact them ? Please let me know
I opened an issue there as well, https://github.com/PokeAPI/pokeapi/issues/1063. I have a fix in my fork that adds a branch to the endpoint macro for unnamed resources, assuming that his is intentional just not documented, https://github.com/AnActualEmerald/rustemon/commit/876859c9d224a3f6e21624aea81b805c98d84bb7. Depending on what pokeapi's response is there may be other endpoints that would affected by this too.
I agree! Let's wait for their answer and we'll proceed accordingly.
In the meantime, thanks again for your work and patience!
@AnActualEmerald Hey there !
Is it still an issue ?
Yes, and it looks like the PokeAPI docs have been updated with the corrected info (as discussed in https://github.com/PokeAPI/pokeapi/issues/1063) https://pokeapi.co/docs/v2#resource-listspagination-section.
Oh cool ! Do you want to contribute and make the changes yourself or you rather prefer me to do it ?