PokeAPI / pokedex-promise-v2

An easy way to use pokeapi v2 with promises in node.js
MIT License
510 stars 89 forks source link

Question and default sprite #61

Closed EchedelleLR closed 2 years ago

EchedelleLR commented 2 years ago

Good morning and thank you for this awesome library and project.

A classmate and I have been developing a little Pokedex application using React, choosing PokeAPI in the process, as part of the project of the vocational training course in which we are studying.

This library has been useful for that, although I am still wondering if I could need the browser wrapper instead of this one once we build the React and deploy it in a server with "forever-service" node app.

The API, however, has some faulty sprites for the Items, which has been outdated for 3 years, as far we saw in the repository.

That means that the API returns a null whenever we get a faulty object.

Based in our experience developing a MovieDB app using TheMovieDB API directly; in which we had to deal filtering nulls, empty arrays and empty strings between other; I would like to ask if this wrapper could do the so called filtering, in the items images at least, providing a default sprite instead of null.

Naramsim commented 2 years ago

Hi @EchedeyLR, thanks for using the wrapper. We already had a bit of a discussion about whether null values should be present of the entire key:value pair should be dropped if the value is null. But we didn't finish discussing/we didn't have time for implementing a proposal.

That said, for the .sprites JSON property all the fields are always returned and you can check for null values to find out if we lack that sprite.


Can you point me to faulty sprites? If you mean that null is returned then we don't consider that faulty but simply lacking the sprite. An example could be Minior which mostly lacks all the sprites. This happens a lot for new generations' pokemon.

Which 'default sprite' should we return if we miss the sprite? Are you suggesting a placeholder such as these?


If your app is in React you could switch to the browser wrapper which has more browser features.

EchedelleLR commented 2 years ago

Seems GitHub has some issue with replying by email with a Disroot address.

I post here what I was supposed to say:

Our issues were mainly in "effect" field inside "effect_entries" for several abilities of the last generation applied also to Pokémon from the first one, since the array was empty.

About the sprites, a good placeholder could be a pixelart-based question mark with the Pikachu form behind.

Related to the browser wrapper... Well, we had an issue since it didn't load when I did NPM start, and the console just told me that I was loading part of it insecurely. Of course, we test in localhost through http and we couldn't make it work.

I can check the exact sentence when I arrive at home, but the issue was loading part of the dependency itself in runtime.

Meanwhile, we could use the node wrapper just running the built React result with "serve" http nodejs server (we are that new in React) which could help us to run it on top of node to use the wrapper and combined with "forever-service".

Given that, is there a way to filter the API by generation?

We just thought about it but we ran into issues trying to filter the API because in abilities, generation is in their own field but it is not the same for the rest (other Pokémon things and related to other endpoints, etc).

The faulty sprites is something weird: In some Pokémon the sprite was under sprite but you have to lower a level inside a strange field with the generation. Given that only happened with last generation, this was the trigger to try to filter by generation.

In addition, the sprites of the items seem to have stopped to be uploaded since 3 years ago, so there are some from older generations also lacking.

As before, I can try to check this later but we just have a week to deliver this and we started it on Monday. We have to finish it at Sunday at max.

Since you clarified us the situation with the faulty fields, I can try to filter the exact checking based in the information you provided to us.

EchedelleLR commented 2 years ago

The sprite number 0 (which is a question mark) in your sprites repository is a good sprite for Pokémon without one.

In the Items, there are some with a similar sprite with question mark but not all.

That is something we discovered yesterday. We recycled the picture of the Items for everything as was designed in pixelart which fits well with most of the sprites.

EchedelleLR commented 2 years ago

I close this issue since we finished our project. Its repository is hosted at https://codeberg.org/nyaaprojects/pokereact.

I will create separated issues in the correspondents repositories here for the things I mentioned before and other my groupmate and I found.