Repository navigation
Conversation
|
Hi! just a quick question, currently you used the is it correct? Should we use Example: Gumshoos. https://pokeapi.co/api/v2/pokemon-species/735/ we have two According to the chart you posted the two
|
Thanks for the quick review! I used species on purpose. Couple reasons. Although the spreadsheet has more precise information, for this feature I defined ball legality as "can this species exist in this ball, in any form, in any game", and combined the sheet's variant rows per species. "In any form" includes variants like Totem Gumshoos. I think this will make more sense to most users and avoid confusion. It also loses very little, because only 26 species have variants with different legality at all, and most of them are pretty obvious like pokeball only gifts. Going with pokemon-form would be especially problematic. Someone checking Vivillon's legality would have to work out which of the 20 patterns they have, when 19 of them have identical legality anyway. Nobody's first instinct would be to look up vivillon-archipelago instead of just Vivillon. Some technical issues as well. Right now, I just had to map the data by using the pokedex number. Going per pokemon would mean hand mapping sheet names to PokeAPI names ("Mega Venusaur" → venusaur-mega, "Nidoran♀" → nidoran-f) and writing rules for about 250 pokemon the sheet doesn't cover, like Megas, Gmax and battle forms. That leaves room for errors, and every future sheet update would need the mapping maintained too, which makes contributing harder as new games add more forms and strange ways to name pokemon. However, if you think that one of the two would be a better idea, I'm happy to switch. Again it might be a difficult job in the future to integrate new data, but for now I should be able to build a working name map. In that case, should Megas, Gmax and battle-only forms be empty, or copy their base form's balls? |
Change description
Closes #1612 (Ball legality). This adds a legal_balls field to
/api/v2/pokemon-species/{id}/, listing ball legality for all pokemonsScope
Covers 24 balls: Poké, Great, Ultra, Premier, Nest, Repeat, Dive, Net, Timer, Luxury, Dusk, Heal, Quick, Safari, Sport, Fast, Friend, Heavy, Level, Love, Lure, Moon, Dream and Beast. Master Ball, Cherish Ball and the Legends Arceus balls are not included.
Data source & credit
The data comes from mariomaniac432's spreadsheet.
https://docs.google.com/spreadsheets/d/1jbYzsjuIIGtf7VFgIgV3NDgX4Ym_rXtW4qp-dHbLHbo
How to test
Test results
BallLegalityCSVDataIntegrityTestCase.test_ball_legality_rowschecked that every species id exists inpokemon_species.csv, that every item is one of the 24 supported balls, that there are no duplicate rows, and that the file isn't empty.APITests.test_pokemon_species_legal_ballschecked that a species with no data returns[], that one species' balls don't appear on another, and that results are ordered by item id.APITests.test_pokemon_species_apinow also asserts thelegal_ballsnames and URLs.AI coding assistance disclosure
Used AI to decode the sheet's value codes and column order from its ReadMe and header images, writing the CSV conversion script, and flagging data issues.
Contributor check list