Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get all evolution chains due to missing field #27

Open
AnActualEmerald opened this issue Apr 2, 2024 · 4 comments
Open

Can't get all evolution chains due to missing field #27

AnActualEmerald opened this issue Apr 2, 2024 · 4 comments

Comments

@AnActualEmerald
Copy link

AnActualEmerald commented Apr 2, 2024

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

@mlemesle
Copy link
Owner

mlemesle commented Apr 2, 2024

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

@AnActualEmerald
Copy link
Author

I opened an issue there as well, PokeAPI/pokeapi#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, AnActualEmerald@876859c. Depending on what pokeapi's response is there may be other endpoints that would affected by this too.

@mlemesle
Copy link
Owner

mlemesle commented Apr 2, 2024

I agree!
Let's wait for their answer and we'll proceed accordingly.

In the meantime, thanks again for your work and patience!

@mlemesle
Copy link
Owner

@AnActualEmerald Hey there !

Is it still an issue ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants