Skip to content

add missing EvolutionDetail fields for regional-variant evolutions - #160

Open
wantaekchoi wants to merge 1 commit into
PokeAPI:mainfrom
wantaekchoi:fix/evolution-detail-missing-fields
Open

add missing EvolutionDetail fields for regional-variant evolutions#160
wantaekchoi wants to merge 1 commit into
PokeAPI:mainfrom
wantaekchoi:fix/evolution-detail-missing-fields

Conversation

@wantaekchoi

Copy link
Copy Markdown

EvolutionDetail (model/evolution.kt) was missing 11 fields present in the current PokeAPI schema: base_form, evolved_form, used_move, region, is_default, near_special_rock, needs_multiplayer, min_damage_taken, min_move_count, min_steps, and version_group. Because PokeApiJson sets ignoreUnknownKeys = true, these fields were silently dropped during deserialization instead of causing a visible failure.

This causes user-facing data loss: species with regional-variant evolutions (e.g. Wooper → Quagsire in most games, but Wooper → Clodsire in Scarlet/Violet) are only distinguishable via version_group/base_form. Without those fields, both evolution branches decoded to structurally identical EvolutionDetail objects.

Fix

Added the 11 fields to EvolutionDetail, all with null/false defaults per the existing style (matching needsOverworldRain, turnUpsideDown, etc.). PokeAPI's own schema has these as nullable foreign keys / default=False booleans, so optional fields model the API correctly.

I deliberately did not bump the api-data test-data submodule. Its pinned snapshot predates this schema (the fields are absent or null-only placeholders there), so bumping it is a much larger, separate scope; this PR is a targeted addition that a later submodule bump can supersede.

Test

Since the pinned local fixture can't distinguish the two branches, I embedded a real /api/v2/evolution-chain/96 (Wooper) response, fetched live from pokeapi.co, as a JSON string and decode it directly with the library's internal PokeApiJson (the same pattern EndpointTest already uses). The test asserts the Quagsire and Clodsire branches decode to distinct EvolutionDetails that differ exactly by versionGroup/baseForm, matching real API data.

Verification

Confirmed the bug reproduces (both branches collapse to the same object) when the two distinguishing fields are temporarily stripped. All 183 pre-existing tests still pass unmodified, plus the new regression test above, for 184 passing against the current submodule pin.

AI assistance disclosure: parts of this change (schema diffing, fixture verification, drafting) were done with AI assistance; all test evidence was produced by running the actual test suite.

@Naramsim

Copy link
Copy Markdown
Member

Hi thanks!

This is due to some recent modifications to the API. @sargun can you take a look, request any changes and merge?

@Naramsim

Copy link
Copy Markdown
Member

@wantaekchoi how did you find all these bugs and fix them? Did you instruct your AI to scan our repositories? Or did you find the bugs by yourself?

@wantaekchoi

Copy link
Copy Markdown
Author

@wantaekchoi how did you find all these bugs and fix them? Did you instruct your AI to scan our repositories? Or did you find the bugs by yourself?

Hi! I pick the repos and the areas to look at, then have Claude Code read
through them and surface candidates. I decide which ones are real, and I don't
file anything until I've reproduced it with a failing test. It drafted these
descriptions from a template too, and I lean on it more here since I don't
really know Kotlin.

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