Skip to content

Conversation

BitTim
Copy link

@BitTim BitTim commented Sep 24, 2025

Also updated related data and tests

What is this PR about?

This PR solves #1266 since it was something I need for my personal project as well.
In general, all I did was add a new field to PokemonDexNumber, that references a specific Pokemon as well, since there are Pokedexes (Basically every one from Gen 7 up until now) that have regional variants of Pokemon, which were not differentiated in the API up until now (There is also the Blueberry Dex from Gen 9 that has regional variants from regions that differ from the games region). The Pokemon themselves return also now contain a 'pokedex_numbers' array field, to be consistent with Pokemon Species.

How to test

Spin up a local instance of the API with the most recent migrations and request any pokedex (I recommend id 33) and observe the pokemon_entries field. Each item should now contain a fourth 'pokemon' field that references a Pokemon. Example (Omitted some fields and values for clarity):

https://<base_url>/api/v2/pokedex/33

{
  "id": 33,
  "name": "blueberry",
  "pokemon_entries": [
    {
      "entry_number": 3,
      "pokemon_species": {
        "name": "exeggcute",
        "url": "http://localhost:8000/api/v2/pokemon-species/102/"
      },
      "pokemon": {
        "name": "exeggcute",
        "url": "http://localhost:8000/api/v2/pokemon/102/"
      }
    },
    {
      "entry_number": 4,
      "pokemon_species": {
        "name": "exeggutor",
        "url": "http://localhost:8000/api/v2/pokemon-species/103/"
      },
      "pokemon": {
        "name": "exeggutor-alola",
        "url": "http://localhost:8000/api/v2/pokemon/10114/"
      }
    }
  ]
}

Pokemon now also contain the 'pokedex_numbers' field, one can request any Pokemon and observe the contents of that field as well. Example (Omitted some fields and values for clarity):

https://<base_url>/api/v2/pokemon/194

{
  "id": 194,
  "name": "wooper",
  "pokedex_numbers": [
    {
      "entry_number": 58,
      "pokedex": {
        "name": "isle-of-armor",
        "url": "http://localhost:8000/api/v2/pokedex/28/"
      }
    },
    {
      "entry_number": 5,
      "pokedex": {
        "name": "kitakami",
        "url": "http://localhost:8000/api/v2/pokedex/32/"
      }
    }
  ]
}

What about compatibility?

Since I only added the new fields while keeping the existing ones, there should be no issues with compatibility with already existing clients.

Where did the data come from?

The data I updated the CSV with was input by hand and came from a combination of PokeWiki and the already present PokeApi.

@Naramsim
Copy link
Member

Hi! Thanks for the contribution! I'm checking it out locally in the next days. In the meantime, could you remove from the PR all the files that have been just formatted? So that's going to be easier for me to review all the changes

- I used black to format the entire project while I was fighting with the CI/CD pipeline
@BitTim
Copy link
Author

BitTim commented Sep 27, 2025

Hi! Thank you for taking your time reviewing my PR! I just pushed the commit where I reverted the files that I had reformatted while fighting with the CI Pipeline that are not relevant to this PR

@Naramsim
Copy link
Member

Naramsim commented Oct 1, 2025

Hi! We merged a PR that brought in a schema change and now your branch fails. Could you take a look?

- Swapped migrations 0019 and 0020 to keep them in order of merges on master
@BitTim
Copy link
Author

BitTim commented Oct 1, 2025

Already on it, I was testing locally before I pushed the fix, should be working again

@BitTim
Copy link
Author

BitTim commented Oct 8, 2025

Hey, just wanted to check if there are any updates? Just curious, not trying to rush

@Naramsim
Copy link
Member

Hi Sorry I'm extremely busy at the moment!

@BitTim
Copy link
Author

BitTim commented Oct 10, 2025

No worries! Like I said, I was just curious

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

Successfully merging this pull request may close these issues.

2 participants