Skip to content

Commit

Permalink
fix: ensure getByPokedexNumber has the correct boundaries
Browse files Browse the repository at this point in the history
  • Loading branch information
favna committed Feb 25, 2024
1 parent be8403d commit c232686
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion graphql/resolvers.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ type Query {
"Whether to reverse the list of games from which to get the data. By default Generation 1 is considered for `take` first, when setting this to true that is instead Generation 8."
reverseFlavorTexts: Boolean = true

"The International PokéDex number of the Pokémon to look up"
"""
The International PokéDex number of the Pokémon to look up.
The valid value ranges are (boundaries inclusive) `-5000` to `-5014` and `-72` to `1025`
"""
number: Int!
): Pokemon!

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface GetPokemonByDexNumberArgs extends BasePokemonArgs {
}

const getPokemonByDexNumberSchema: SchemaOf<GetPokemonByDexNumberArgs> = basePokemonArgsSchema.extend({
number: s.number.greaterThanOrEqual(-68).lessThanOrEqual(905)
number: s.number.greaterThanOrEqual(-72).lessThanOrEqual(1025).or(s.number.greaterThanOrEqual(-5014).lessThanOrEqual(-5000))
});

export function validateGetPokemonByDexNumberArgs(args: GetPokemonByDexNumberArgs): NonNullish<GetPokemonByDexNumberArgs> {
Expand Down

0 comments on commit c232686

Please sign in to comment.