From 082ea57d774500c53ae07d73748dfee8d2ab8f8e Mon Sep 17 00:00:00 2001 From: Robert Williams Date: Fri, 2 Feb 2024 15:16:58 -0600 Subject: [PATCH 01/49] Updating MoveDetailSerializer to change $effect_chance to actual number --- data/v2/csv/move_effect_prose.csv | 4 +--- pokemon_v2/serializers.py | 7 ++++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/data/v2/csv/move_effect_prose.csv b/data/v2/csv/move_effect_prose.csv index 958ddbdf4..3ad875593 100644 --- a/data/v2/csv/move_effect_prose.csv +++ b/data/v2/csv/move_effect_prose.csv @@ -153,9 +153,7 @@ This move cannot be copied by []{move:mimic} or []{move:mirror-move}, nor select The user takes damage instead of being healed if the target has []{ability:liquid-ooze}. []{move:rapid-spin} will remove this effect. - -This effect is passed on by []{move:baton-pass}." -86,9,Does nothing.,"Does nothing. +7,9,Has a $e. This move cannot be used while []{move:gravity} is in effect." 87,9,Disables the target's last used move for 1-8 turns.,"Disables the target's last used move, preventing its use for 4–7 turns, selected at random, or until the target leaves the [field]{mechanic:field}. If the target hasn't used a move since entering the [field]{mechanic:field}, if it tried to use a move this turn and [failed]{mechanic:failed}, if its last used move has 0 PP remaining, or if it already has a move disabled, this move will fail." diff --git a/pokemon_v2/serializers.py b/pokemon_v2/serializers.py index c7a4773c8..d03858f52 100644 --- a/pokemon_v2/serializers.py +++ b/pokemon_v2/serializers.py @@ -2343,7 +2343,12 @@ def get_effect_text(self, obj): data = MoveEffectEffectTextSerializer( effect_texts, many=True, context=self.context ).data - + effect_entries = data[0] + for i, k in enumerate(effect_entries): + print(i, k) + if '$effect_chance%' in effect_entries[k]: + data[0][k] = effect_entries[k].replace('$effect_chance', f'{obj.move_effect_chance}') + return data def get_effect_change_text(self, obj): From ffa89bdfc5831483a67997ebb76fa59a211f1030 Mon Sep 17 00:00:00 2001 From: Robert Williams Date: Fri, 2 Feb 2024 17:06:36 -0600 Subject: [PATCH 02/49] fixing a debugging print line --- pokemon_v2/serializers.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pokemon_v2/serializers.py b/pokemon_v2/serializers.py index d03858f52..7c18d44ec 100644 --- a/pokemon_v2/serializers.py +++ b/pokemon_v2/serializers.py @@ -2345,7 +2345,6 @@ def get_effect_text(self, obj): ).data effect_entries = data[0] for i, k in enumerate(effect_entries): - print(i, k) if '$effect_chance%' in effect_entries[k]: data[0][k] = effect_entries[k].replace('$effect_chance', f'{obj.move_effect_chance}') From 74b4d0a0eaf22eddd78b226543b991a696057581 Mon Sep 17 00:00:00 2001 From: Robert Williams Date: Fri, 2 Feb 2024 17:24:03 -0600 Subject: [PATCH 03/49] replacing move_effect_prose.csv with original --- data/v2/csv/move_effect_prose.csv | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/data/v2/csv/move_effect_prose.csv b/data/v2/csv/move_effect_prose.csv index 3ad875593..958ddbdf4 100644 --- a/data/v2/csv/move_effect_prose.csv +++ b/data/v2/csv/move_effect_prose.csv @@ -153,7 +153,9 @@ This move cannot be copied by []{move:mimic} or []{move:mirror-move}, nor select The user takes damage instead of being healed if the target has []{ability:liquid-ooze}. []{move:rapid-spin} will remove this effect. -7,9,Has a $e. + +This effect is passed on by []{move:baton-pass}." +86,9,Does nothing.,"Does nothing. This move cannot be used while []{move:gravity} is in effect." 87,9,Disables the target's last used move for 1-8 turns.,"Disables the target's last used move, preventing its use for 4–7 turns, selected at random, or until the target leaves the [field]{mechanic:field}. If the target hasn't used a move since entering the [field]{mechanic:field}, if it tried to use a move this turn and [failed]{mechanic:failed}, if its last used move has 0 PP remaining, or if it already has a move disabled, this move will fail." From 41818e4755d90437d38ffbc7fbd6461a8b22e08d Mon Sep 17 00:00:00 2001 From: Robert Williams Date: Sat, 3 Feb 2024 21:56:25 -0600 Subject: [PATCH 04/49] removing unnecessary line --- pokemon_v2/serializers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pokemon_v2/serializers.py b/pokemon_v2/serializers.py index 7c18d44ec..07d21cd0b 100644 --- a/pokemon_v2/serializers.py +++ b/pokemon_v2/serializers.py @@ -2343,10 +2343,10 @@ def get_effect_text(self, obj): data = MoveEffectEffectTextSerializer( effect_texts, many=True, context=self.context ).data + effect_entries = data[0] for i, k in enumerate(effect_entries): - if '$effect_chance%' in effect_entries[k]: - data[0][k] = effect_entries[k].replace('$effect_chance', f'{obj.move_effect_chance}') + data[0][k] = effect_entries[k].replace('$effect_chance', f'{obj.move_effect_chance}') return data From d234ef9def4a8eb76c4159ae70fa2905b301c48b Mon Sep 17 00:00:00 2001 From: Robert Williams Date: Sat, 3 Feb 2024 22:02:23 -0600 Subject: [PATCH 05/49] that line was needed after all --- pokemon_v2/serializers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pokemon_v2/serializers.py b/pokemon_v2/serializers.py index 07d21cd0b..7c18d44ec 100644 --- a/pokemon_v2/serializers.py +++ b/pokemon_v2/serializers.py @@ -2343,10 +2343,10 @@ def get_effect_text(self, obj): data = MoveEffectEffectTextSerializer( effect_texts, many=True, context=self.context ).data - effect_entries = data[0] for i, k in enumerate(effect_entries): - data[0][k] = effect_entries[k].replace('$effect_chance', f'{obj.move_effect_chance}') + if '$effect_chance%' in effect_entries[k]: + data[0][k] = effect_entries[k].replace('$effect_chance', f'{obj.move_effect_chance}') return data From 74bb5b28b52aa2c53906c547d35c6e98edbd48a5 Mon Sep 17 00:00:00 2001 From: Robert Williams Date: Fri, 9 Feb 2024 23:30:52 -0600 Subject: [PATCH 06/49] fixing linter issue --- pokemon_v2/serializers.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pokemon_v2/serializers.py b/pokemon_v2/serializers.py index 7c18d44ec..67e181a2c 100644 --- a/pokemon_v2/serializers.py +++ b/pokemon_v2/serializers.py @@ -2344,10 +2344,12 @@ def get_effect_text(self, obj): effect_texts, many=True, context=self.context ).data effect_entries = data[0] - for i, k in enumerate(effect_entries): - if '$effect_chance%' in effect_entries[k]: - data[0][k] = effect_entries[k].replace('$effect_chance', f'{obj.move_effect_chance}') - + for _i, k in enumerate(effect_entries): + if "$effect_chance%" in effect_entries[k]: + data[0][k] = effect_entries[k].replace( + "$effect_chance", f"{obj.move_effect_chance}" + ) + return data def get_effect_change_text(self, obj): From 6775022635e6b9f1b4245e43e16f1596c85243e8 Mon Sep 17 00:00:00 2001 From: Robert Williams Date: Sat, 10 Feb 2024 19:56:30 -0600 Subject: [PATCH 07/49] making simonorono's suggest changes --- pokemon_v2/serializers.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pokemon_v2/serializers.py b/pokemon_v2/serializers.py index 67e181a2c..cef6f6b13 100644 --- a/pokemon_v2/serializers.py +++ b/pokemon_v2/serializers.py @@ -2343,12 +2343,12 @@ def get_effect_text(self, obj): data = MoveEffectEffectTextSerializer( effect_texts, many=True, context=self.context ).data - effect_entries = data[0] - for _i, k in enumerate(effect_entries): - if "$effect_chance%" in effect_entries[k]: - data[0][k] = effect_entries[k].replace( - "$effect_chance", f"{obj.move_effect_chance}" - ) + if len(data) > 0: + for key, value in data[0].items(): + if "$effect_chance%" in value: + data[0][key] = value.replace( + "$effect_chance", f"{obj.move_effect_chance}" + ) return data From 4bc132d82ca7e4131a46d661352abde8102b9b4f Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Sat, 24 Feb 2024 01:31:34 -0600 Subject: [PATCH 08/49] docs(openapi): add `drf-spectacular` and default settings --- config/settings.py | 11 +++++++++++ requirements.txt | 1 + 2 files changed, 12 insertions(+) diff --git a/config/settings.py b/config/settings.py index 8213dd2e0..9679b799d 100755 --- a/config/settings.py +++ b/config/settings.py @@ -99,6 +99,7 @@ "corsheaders", "rest_framework", "cachalot", + 'drf_spectacular', ) + CUSTOM_APPS @@ -116,6 +117,7 @@ "DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.LimitOffsetPagination", "PAGE_SIZE": 20, "PAGINATE_BY": 20, + 'DEFAULT_SCHEMA_CLASS': 'drf_spectacular.openapi.AutoSchema', } @@ -136,3 +138,12 @@ ] DEFAULT_AUTO_FIELD = "django.db.models.AutoField" + +SPECTACULAR_SETTINGS = { + 'TITLE': 'Your Project API', + 'DESCRIPTION': 'Your project description', + 'VERSION': '1.0.0', + 'SERVE_INCLUDE_SCHEMA': False, + # OTHER SETTINGS +} + diff --git a/requirements.txt b/requirements.txt index c7d6d4a69..7c5ef92eb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,3 +11,4 @@ mimeparse==0.1.3 psycopg2-binary==2.9.9 python-dateutil==2.8.2 python-mimeparse==1.6.0 +drf-spectacular==0.27.1 From 7f2d2bdf833c9b53718f68cdcd300ea0f5e61166 Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Sat, 24 Feb 2024 01:48:34 -0600 Subject: [PATCH 09/49] docs(openapi): update spectacular settings --- config/settings.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/config/settings.py b/config/settings.py index 9679b799d..71a163d3f 100755 --- a/config/settings.py +++ b/config/settings.py @@ -140,10 +140,12 @@ DEFAULT_AUTO_FIELD = "django.db.models.AutoField" SPECTACULAR_SETTINGS = { - 'TITLE': 'Your Project API', - 'DESCRIPTION': 'Your project description', - 'VERSION': '1.0.0', + 'TITLE': 'pokeapi', + 'DESCRIPTION': 'A RESTful API for Pokémon.', + 'SERVERS': [{'url': 'https://pokeapi.co/api/v2'}], + 'EXTERNAL_DOCS': {'url': 'https://pokeapi.co/docs/v2'}, + 'VERSION': '2.7.0', 'SERVE_INCLUDE_SCHEMA': False, - # OTHER SETTINGS + 'OAS_VERSION': '3.1.0', } From 3a1f9dbf4a483994e1abbe883b11350d12907c28 Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Sat, 24 Feb 2024 02:05:22 -0600 Subject: [PATCH 10/49] docs(openapi): update `SERVERS` --- config/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/settings.py b/config/settings.py index 71a163d3f..ce9b8382f 100755 --- a/config/settings.py +++ b/config/settings.py @@ -142,7 +142,7 @@ SPECTACULAR_SETTINGS = { 'TITLE': 'pokeapi', 'DESCRIPTION': 'A RESTful API for Pokémon.', - 'SERVERS': [{'url': 'https://pokeapi.co/api/v2'}], + 'SERVERS': [{'url': 'https://pokeapi.co'}], 'EXTERNAL_DOCS': {'url': 'https://pokeapi.co/docs/v2'}, 'VERSION': '2.7.0', 'SERVE_INCLUDE_SCHEMA': False, From 701f2a78b632a6b369eff2137c2faa035110325f Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Sat, 24 Feb 2024 02:06:23 -0600 Subject: [PATCH 11/49] docs(openapi): add `openapi.yml` --- openapi.yml | 6882 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 6882 insertions(+) create mode 100644 openapi.yml diff --git a/openapi.yml b/openapi.yml new file mode 100644 index 000000000..d09e5a431 --- /dev/null +++ b/openapi.yml @@ -0,0 +1,6882 @@ +openapi: 3.1.0 +info: + title: pokeapi + version: 2.7.0 + description: A RESTful API for Pokémon. +paths: + /api/v2/ability/: + get: + operationId: ability_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - ability + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedAbilitySummaryList' + description: '' + /api/v2/ability/{id}/: + get: + operationId: ability_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this ability. + required: true + tags: + - ability + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/AbilityDetail' + description: '' + /api/v2/berry/: + get: + operationId: berry_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - berry + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedBerrySummaryList' + description: '' + /api/v2/berry-firmness/: + get: + operationId: berry_firmness_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - berry-firmness + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedBerryFirmnessSummaryList' + description: '' + /api/v2/berry-firmness/{id}/: + get: + operationId: berry_firmness_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this berry firmness. + required: true + tags: + - berry-firmness + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/BerryFirmnessDetail' + description: '' + /api/v2/berry-flavor/: + get: + operationId: berry_flavor_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - berry-flavor + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedBerryFlavorSummaryList' + description: '' + /api/v2/berry-flavor/{id}/: + get: + operationId: berry_flavor_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this berry flavor. + required: true + tags: + - berry-flavor + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/BerryFlavorDetail' + description: '' + /api/v2/berry/{id}/: + get: + operationId: berry_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this berry. + required: true + tags: + - berry + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/BerryDetail' + description: '' + /api/v2/characteristic/: + get: + operationId: characteristic_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - characteristic + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedCharacteristicSummaryList' + description: '' + /api/v2/characteristic/{id}/: + get: + operationId: characteristic_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this characteristic. + required: true + tags: + - characteristic + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/CharacteristicDetail' + description: '' + /api/v2/contest-effect/: + get: + operationId: contest_effect_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - contest-effect + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedContestEffectSummaryList' + description: '' + /api/v2/contest-effect/{id}/: + get: + operationId: contest_effect_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this contest effect. + required: true + tags: + - contest-effect + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ContestEffectDetail' + description: '' + /api/v2/contest-type/: + get: + operationId: contest_type_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - contest-type + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedContestTypeSummaryList' + description: '' + /api/v2/contest-type/{id}/: + get: + operationId: contest_type_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this contest type. + required: true + tags: + - contest-type + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ContestTypeDetail' + description: '' + /api/v2/egg-group/: + get: + operationId: egg_group_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - egg-group + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedEggGroupSummaryList' + description: '' + /api/v2/egg-group/{id}/: + get: + operationId: egg_group_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this egg group. + required: true + tags: + - egg-group + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/EggGroupDetail' + description: '' + /api/v2/encounter-condition/: + get: + operationId: encounter_condition_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - encounter-condition + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedEncounterConditionSummaryList' + description: '' + /api/v2/encounter-condition-value/: + get: + operationId: encounter_condition_value_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - encounter-condition-value + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedEncounterConditionValueSummaryList' + description: '' + /api/v2/encounter-condition-value/{id}/: + get: + operationId: encounter_condition_value_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this encounter condition value. + required: true + tags: + - encounter-condition-value + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/EncounterConditionValueDetail' + description: '' + /api/v2/encounter-condition/{id}/: + get: + operationId: encounter_condition_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this encounter condition. + required: true + tags: + - encounter-condition + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/EncounterConditionDetail' + description: '' + /api/v2/encounter-method/: + get: + operationId: encounter_method_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - encounter-method + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedEncounterMethodSummaryList' + description: '' + /api/v2/encounter-method/{id}/: + get: + operationId: encounter_method_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this encounter method. + required: true + tags: + - encounter-method + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/EncounterMethodDetail' + description: '' + /api/v2/evolution-chain/: + get: + operationId: evolution_chain_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - evolution-chain + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedEvolutionChainSummaryList' + description: '' + /api/v2/evolution-chain/{id}/: + get: + operationId: evolution_chain_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this evolution chain. + required: true + tags: + - evolution-chain + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/EvolutionChainDetail' + description: '' + /api/v2/evolution-trigger/: + get: + operationId: evolution_trigger_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - evolution-trigger + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedEvolutionTriggerSummaryList' + description: '' + /api/v2/evolution-trigger/{id}/: + get: + operationId: evolution_trigger_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this evolution trigger. + required: true + tags: + - evolution-trigger + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/EvolutionTriggerDetail' + description: '' + /api/v2/gender/: + get: + operationId: gender_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - gender + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedGenderSummaryList' + description: '' + /api/v2/gender/{id}/: + get: + operationId: gender_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this gender. + required: true + tags: + - gender + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/GenderDetail' + description: '' + /api/v2/generation/: + get: + operationId: generation_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - generation + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedGenerationSummaryList' + description: '' + /api/v2/generation/{id}/: + get: + operationId: generation_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this generation. + required: true + tags: + - generation + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/GenerationDetail' + description: '' + /api/v2/growth-rate/: + get: + operationId: growth_rate_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - growth-rate + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedGrowthRateSummaryList' + description: '' + /api/v2/growth-rate/{id}/: + get: + operationId: growth_rate_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this growth rate. + required: true + tags: + - growth-rate + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/GrowthRateDetail' + description: '' + /api/v2/item/: + get: + operationId: item_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - item + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedItemSummaryList' + description: '' + /api/v2/item-attribute/: + get: + operationId: item_attribute_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - item-attribute + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedItemAttributeSummaryList' + description: '' + /api/v2/item-attribute/{id}/: + get: + operationId: item_attribute_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this item attribute. + required: true + tags: + - item-attribute + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ItemAttributeDetail' + description: '' + /api/v2/item-category/: + get: + operationId: item_category_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - item-category + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedItemCategorySummaryList' + description: '' + /api/v2/item-category/{id}/: + get: + operationId: item_category_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this item category. + required: true + tags: + - item-category + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ItemCategoryDetail' + description: '' + /api/v2/item-fling-effect/: + get: + operationId: item_fling_effect_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - item-fling-effect + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedItemFlingEffectSummaryList' + description: '' + /api/v2/item-fling-effect/{id}/: + get: + operationId: item_fling_effect_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this item fling effect. + required: true + tags: + - item-fling-effect + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ItemFlingEffectDetail' + description: '' + /api/v2/item-pocket/: + get: + operationId: item_pocket_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - item-pocket + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedItemPocketSummaryList' + description: '' + /api/v2/item-pocket/{id}/: + get: + operationId: item_pocket_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this item pocket. + required: true + tags: + - item-pocket + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ItemPocketDetail' + description: '' + /api/v2/item/{id}/: + get: + operationId: item_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this item. + required: true + tags: + - item + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ItemDetail' + description: '' + /api/v2/language/: + get: + operationId: language_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - language + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedLanguageSummaryList' + description: '' + /api/v2/language/{id}/: + get: + operationId: language_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this language. + required: true + tags: + - language + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/LanguageDetail' + description: '' + /api/v2/location/: + get: + operationId: location_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - location + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedLocationSummaryList' + description: '' + /api/v2/location-area/: + get: + operationId: location_area_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - location-area + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedLocationAreaSummaryList' + description: '' + /api/v2/location-area/{id}/: + get: + operationId: location_area_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this location area. + required: true + tags: + - location-area + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/LocationAreaDetail' + description: '' + /api/v2/location/{id}/: + get: + operationId: location_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this location. + required: true + tags: + - location + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/LocationDetail' + description: '' + /api/v2/machine/: + get: + operationId: machine_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - machine + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedMachineSummaryList' + description: '' + /api/v2/machine/{id}/: + get: + operationId: machine_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this machine. + required: true + tags: + - machine + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/MachineDetail' + description: '' + /api/v2/move/: + get: + operationId: move_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - move + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedMoveSummaryList' + description: '' + /api/v2/move-ailment/: + get: + operationId: move_ailment_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - move-ailment + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedMoveMetaAilmentSummaryList' + description: '' + /api/v2/move-ailment/{id}/: + get: + operationId: move_ailment_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this move meta ailment. + required: true + tags: + - move-ailment + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/MoveMetaAilmentDetail' + description: '' + /api/v2/move-battle-style/: + get: + operationId: move_battle_style_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - move-battle-style + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedMoveBattleStyleSummaryList' + description: '' + /api/v2/move-battle-style/{id}/: + get: + operationId: move_battle_style_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this move battle style. + required: true + tags: + - move-battle-style + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/MoveBattleStyleDetail' + description: '' + /api/v2/move-category/: + get: + operationId: move_category_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - move-category + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedMoveMetaCategorySummaryList' + description: '' + /api/v2/move-category/{id}/: + get: + operationId: move_category_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this move meta category. + required: true + tags: + - move-category + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/MoveMetaCategoryDetail' + description: '' + /api/v2/move-damage-class/: + get: + operationId: move_damage_class_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - move-damage-class + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedMoveDamageClassSummaryList' + description: '' + /api/v2/move-damage-class/{id}/: + get: + operationId: move_damage_class_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this move damage class. + required: true + tags: + - move-damage-class + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/MoveDamageClassDetail' + description: '' + /api/v2/move-learn-method/: + get: + operationId: move_learn_method_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - move-learn-method + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedMoveLearnMethodSummaryList' + description: '' + /api/v2/move-learn-method/{id}/: + get: + operationId: move_learn_method_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this move learn method. + required: true + tags: + - move-learn-method + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/MoveLearnMethodDetail' + description: '' + /api/v2/move-target/: + get: + operationId: move_target_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - move-target + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedMoveTargetSummaryList' + description: '' + /api/v2/move-target/{id}/: + get: + operationId: move_target_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this move target. + required: true + tags: + - move-target + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/MoveTargetDetail' + description: '' + /api/v2/move/{id}/: + get: + operationId: move_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this move. + required: true + tags: + - move + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/MoveDetail' + description: '' + /api/v2/nature/: + get: + operationId: nature_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - nature + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedNatureSummaryList' + description: '' + /api/v2/nature/{id}/: + get: + operationId: nature_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this nature. + required: true + tags: + - nature + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/NatureDetail' + description: '' + /api/v2/pal-park-area/: + get: + operationId: pal_park_area_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - pal-park-area + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedPalParkAreaSummaryList' + description: '' + /api/v2/pal-park-area/{id}/: + get: + operationId: pal_park_area_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this pal park area. + required: true + tags: + - pal-park-area + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PalParkAreaDetail' + description: '' + /api/v2/pokeathlon-stat/: + get: + operationId: pokeathlon_stat_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - pokeathlon-stat + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedPokeathlonStatSummaryList' + description: '' + /api/v2/pokeathlon-stat/{id}/: + get: + operationId: pokeathlon_stat_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this pokeathlon stat. + required: true + tags: + - pokeathlon-stat + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PokeathlonStatDetail' + description: '' + /api/v2/pokedex/: + get: + operationId: pokedex_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - pokedex + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedPokedexSummaryList' + description: '' + /api/v2/pokedex/{id}/: + get: + operationId: pokedex_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this pokedex. + required: true + tags: + - pokedex + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PokedexDetail' + description: '' + /api/v2/pokemon/: + get: + operationId: pokemon_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - pokemon + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedPokemonSummaryList' + description: '' + /api/v2/pokemon-color/: + get: + operationId: pokemon_color_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - pokemon-color + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedPokemonColorSummaryList' + description: '' + /api/v2/pokemon-color/{id}/: + get: + operationId: pokemon_color_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this pokemon color. + required: true + tags: + - pokemon-color + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PokemonColorDetail' + description: '' + /api/v2/pokemon-form/: + get: + operationId: pokemon_form_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - pokemon-form + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedPokemonFormSummaryList' + description: '' + /api/v2/pokemon-form/{id}/: + get: + operationId: pokemon_form_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this pokemon form. + required: true + tags: + - pokemon-form + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PokemonFormDetail' + description: '' + /api/v2/pokemon-habitat/: + get: + operationId: pokemon_habitat_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - pokemon-habitat + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedPokemonHabitatSummaryList' + description: '' + /api/v2/pokemon-habitat/{id}/: + get: + operationId: pokemon_habitat_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this pokemon habitat. + required: true + tags: + - pokemon-habitat + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PokemonHabitatDetail' + description: '' + /api/v2/pokemon-shape/: + get: + operationId: pokemon_shape_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - pokemon-shape + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedPokemonShapeSummaryList' + description: '' + /api/v2/pokemon-shape/{id}/: + get: + operationId: pokemon_shape_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this pokemon shape. + required: true + tags: + - pokemon-shape + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PokemonShapeDetail' + description: '' + /api/v2/pokemon-species/: + get: + operationId: pokemon_species_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - pokemon-species + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedPokemonSpeciesSummaryList' + description: '' + /api/v2/pokemon-species/{id}/: + get: + operationId: pokemon_species_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this pokemon species. + required: true + tags: + - pokemon-species + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PokemonSpeciesDetail' + description: '' + /api/v2/pokemon/{id}/: + get: + operationId: pokemon_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this pokemon. + required: true + tags: + - pokemon + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PokemonDetail' + description: '' + /api/v2/pokemon/{pokemon_id}/encounters: + get: + operationId: pokemon_encounters_retrieve + description: Handles Pokemon Encounters as a sub-resource. + parameters: + - in: path + name: pokemon_id + schema: + type: string + pattern: ^\d+$ + required: true + tags: + - pokemon + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + description: No response body + /api/v2/region/: + get: + operationId: region_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - region + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedRegionSummaryList' + description: '' + /api/v2/region/{id}/: + get: + operationId: region_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this region. + required: true + tags: + - region + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/RegionDetail' + description: '' + /api/v2/stat/: + get: + operationId: stat_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - stat + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedStatSummaryList' + description: '' + /api/v2/stat/{id}/: + get: + operationId: stat_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this stat. + required: true + tags: + - stat + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/StatDetail' + description: '' + /api/v2/super-contest-effect/: + get: + operationId: super_contest_effect_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - super-contest-effect + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedSuperContestEffectSummaryList' + description: '' + /api/v2/super-contest-effect/{id}/: + get: + operationId: super_contest_effect_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this super contest effect. + required: true + tags: + - super-contest-effect + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/SuperContestEffectDetail' + description: '' + /api/v2/type/: + get: + operationId: type_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - type + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedTypeSummaryList' + description: '' + /api/v2/type/{id}/: + get: + operationId: type_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this type. + required: true + tags: + - type + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TypeDetail' + description: '' + /api/v2/version/: + get: + operationId: version_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - version + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedVersionSummaryList' + description: '' + /api/v2/version-group/: + get: + operationId: version_group_list + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - name: limit + required: false + in: query + description: Number of results to return per page. + schema: + type: integer + - name: offset + required: false + in: query + description: The initial index from which to return the results. + schema: + type: integer + tags: + - version-group + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PaginatedVersionGroupSummaryList' + description: '' + /api/v2/version-group/{id}/: + get: + operationId: version_group_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this version group. + required: true + tags: + - version-group + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/VersionGroupDetail' + description: '' + /api/v2/version/{id}/: + get: + operationId: version_retrieve + description: |- + Mixin to allow association with separate serializers + for list or detail view. + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this version. + required: true + tags: + - version + security: + - cookieAuth: [] + - basicAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/VersionDetail' + description: '' +components: + schemas: + AbilityChange: + type: object + properties: + version_group: + $ref: '#/components/schemas/VersionGroupSummary' + effect_entries: + type: array + items: + $ref: '#/components/schemas/AbilityChangeEffectText' + readOnly: true + required: + - effect_entries + - version_group + AbilityChangeEffectText: + type: object + properties: + effect: + type: string + maxLength: 6000 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - effect + - language + AbilityDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + is_main_series: + type: boolean + generation: + $ref: '#/components/schemas/GenerationSummary' + names: + type: array + items: + $ref: '#/components/schemas/AbilityName' + readOnly: true + effect_entries: + type: array + items: + $ref: '#/components/schemas/AbilityEffectText' + readOnly: true + effect_changes: + type: array + items: + $ref: '#/components/schemas/AbilityChange' + readOnly: true + flavor_text_entries: + type: array + items: + $ref: '#/components/schemas/AbilityFlavorText' + readOnly: true + pokemon: + type: string + readOnly: true + required: + - effect_changes + - effect_entries + - flavor_text_entries + - generation + - id + - name + - names + - pokemon + AbilityEffectText: + type: object + properties: + effect: + type: string + maxLength: 6000 + short_effect: + type: string + maxLength: 300 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - effect + - language + - short_effect + AbilityFlavorText: + type: object + properties: + flavor_text: + type: string + language: + $ref: '#/components/schemas/LanguageSummary' + version_group: + $ref: '#/components/schemas/VersionGroupSummary' + required: + - flavor_text + - language + - version_group + AbilityName: + type: object + properties: + name: + type: string + maxLength: 100 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + - name + AbilitySummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + BerryDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + growth_time: + type: integer + maximum: 2147483647 + minimum: -2147483648 + max_harvest: + type: integer + maximum: 2147483647 + minimum: -2147483648 + natural_gift_power: + type: integer + maximum: 2147483647 + minimum: -2147483648 + size: + type: integer + maximum: 2147483647 + minimum: -2147483648 + smoothness: + type: integer + maximum: 2147483647 + minimum: -2147483648 + soil_dryness: + type: integer + maximum: 2147483647 + minimum: -2147483648 + firmness: + $ref: '#/components/schemas/BerryFirmnessSummary' + flavors: + type: string + readOnly: true + item: + $ref: '#/components/schemas/ItemSummary' + natural_gift_type: + $ref: '#/components/schemas/TypeSummary' + required: + - firmness + - flavors + - growth_time + - id + - item + - max_harvest + - name + - natural_gift_power + - natural_gift_type + - size + - smoothness + - soil_dryness + BerryFirmnessDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + berries: + type: array + items: + $ref: '#/components/schemas/BerrySummary' + readOnly: true + names: + type: array + items: + $ref: '#/components/schemas/BerryFirmnessName' + readOnly: true + required: + - berries + - id + - name + - names + BerryFirmnessName: + type: object + properties: + name: + type: string + maxLength: 100 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + - name + BerryFirmnessSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + BerryFlavorDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + berries: + type: string + readOnly: true + contest_type: + $ref: '#/components/schemas/ContestTypeSummary' + names: + type: array + items: + $ref: '#/components/schemas/BerryFlavorName' + readOnly: true + required: + - berries + - contest_type + - id + - name + - names + BerryFlavorName: + type: object + properties: + name: + type: string + maxLength: 100 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + - name + BerryFlavorSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + BerrySummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + CharacteristicDescription: + type: object + properties: + description: + type: string + maxLength: 1000 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + CharacteristicDetail: + type: object + properties: + id: + type: integer + readOnly: true + gene_modulo: + type: integer + possible_values: + type: string + readOnly: true + highest_stat: + $ref: '#/components/schemas/StatSummary' + descriptions: + type: array + items: + $ref: '#/components/schemas/CharacteristicDescription' + readOnly: true + required: + - descriptions + - gene_modulo + - highest_stat + - id + - possible_values + CharacteristicSummary: + type: object + properties: + url: + type: string + format: uri + readOnly: true + required: + - url + ContestEffectDetail: + type: object + properties: + id: + type: integer + readOnly: true + appeal: + type: integer + maximum: 2147483647 + minimum: -2147483648 + jam: + type: integer + maximum: 2147483647 + minimum: -2147483648 + effect_entries: + type: array + items: + $ref: '#/components/schemas/ContestEffectEffectText' + readOnly: true + flavor_text_entries: + type: array + items: + $ref: '#/components/schemas/ContestEffectFlavorText' + readOnly: true + required: + - appeal + - effect_entries + - flavor_text_entries + - id + - jam + ContestEffectEffectText: + type: object + properties: + effect: + type: string + maxLength: 6000 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - effect + - language + ContestEffectFlavorText: + type: object + properties: + flavor_text: + type: string + maxLength: 500 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - flavor_text + - language + ContestEffectSummary: + type: object + properties: + url: + type: string + format: uri + readOnly: true + required: + - url + ContestTypeDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + berry_flavor: + allOf: + - $ref: '#/components/schemas/BerryFlavorSummary' + readOnly: true + names: + type: array + items: + $ref: '#/components/schemas/ContestTypeName' + readOnly: true + required: + - berry_flavor + - id + - name + - names + ContestTypeName: + type: object + properties: + name: + type: string + maxLength: 100 + color: + type: string + maxLength: 10 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - color + - language + - name + ContestTypeSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + EggGroupDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + names: + type: array + items: + $ref: '#/components/schemas/EggGroupName' + readOnly: true + pokemon_species: + type: string + readOnly: true + required: + - id + - name + - names + - pokemon_species + EggGroupName: + type: object + properties: + name: + type: string + maxLength: 100 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + - name + EggGroupSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + EncounterConditionDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + values: + type: array + items: + $ref: '#/components/schemas/EncounterConditionValueSummary' + readOnly: true + names: + type: array + items: + $ref: '#/components/schemas/EncounterConditionName' + readOnly: true + required: + - id + - name + - names + - values + EncounterConditionName: + type: object + properties: + name: + type: string + maxLength: 100 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + - name + EncounterConditionSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + EncounterConditionValueDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + condition: + $ref: '#/components/schemas/EncounterConditionSummary' + names: + type: array + items: + $ref: '#/components/schemas/EncounterConditionValueName' + readOnly: true + required: + - condition + - id + - name + - names + EncounterConditionValueName: + type: object + properties: + name: + type: string + maxLength: 100 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + - name + EncounterConditionValueSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + EncounterMethodDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + order: + type: + - integer + - 'null' + maximum: 2147483647 + minimum: -2147483648 + names: + type: array + items: + $ref: '#/components/schemas/EncounterMethodName' + readOnly: true + required: + - id + - name + - names + EncounterMethodName: + type: object + properties: + name: + type: string + maxLength: 100 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + - name + EncounterMethodSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + EvolutionChainDetail: + type: object + properties: + id: + type: integer + readOnly: true + baby_trigger_item: + $ref: '#/components/schemas/ItemSummary' + chain: + type: string + readOnly: true + required: + - baby_trigger_item + - chain + - id + EvolutionChainSummary: + type: object + properties: + url: + type: string + format: uri + readOnly: true + required: + - url + EvolutionTriggerDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + names: + type: array + items: + $ref: '#/components/schemas/EvolutionTriggerName' + readOnly: true + pokemon_species: + type: string + readOnly: true + required: + - id + - name + - names + - pokemon_species + EvolutionTriggerName: + type: object + properties: + name: + type: string + maxLength: 100 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + - name + EvolutionTriggerSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + Experience: + type: object + properties: + level: + type: integer + maximum: 2147483647 + minimum: -2147483648 + experience: + type: integer + maximum: 2147483647 + minimum: -2147483648 + required: + - experience + - level + GenderDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + pokemon_species_details: + type: string + readOnly: true + required_for_evolution: + type: string + readOnly: true + required: + - id + - name + - pokemon_species_details + - required_for_evolution + GenderSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + GenerationDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + abilities: + type: array + items: + $ref: '#/components/schemas/AbilitySummary' + readOnly: true + main_region: + $ref: '#/components/schemas/RegionSummary' + moves: + type: array + items: + $ref: '#/components/schemas/MoveSummary' + readOnly: true + names: + type: array + items: + $ref: '#/components/schemas/GenerationName' + readOnly: true + pokemon_species: + type: array + items: + $ref: '#/components/schemas/PokemonSpeciesSummary' + readOnly: true + types: + type: array + items: + $ref: '#/components/schemas/TypeSummary' + readOnly: true + version_groups: + type: array + items: + $ref: '#/components/schemas/VersionGroupSummary' + readOnly: true + required: + - abilities + - id + - main_region + - moves + - name + - names + - pokemon_species + - types + - version_groups + GenerationName: + type: object + properties: + name: + type: string + maxLength: 100 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + - name + GenerationSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + GrowthRateDescription: + type: object + properties: + description: + type: string + maxLength: 1000 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + GrowthRateDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + formula: + type: string + maxLength: 500 + descriptions: + type: array + items: + $ref: '#/components/schemas/GrowthRateDescription' + readOnly: true + levels: + type: array + items: + $ref: '#/components/schemas/Experience' + readOnly: true + pokemon_species: + type: array + items: + $ref: '#/components/schemas/PokemonSpeciesSummary' + readOnly: true + required: + - descriptions + - formula + - id + - levels + - name + - pokemon_species + GrowthRateSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + ItemAttributeDescription: + type: object + properties: + description: + type: string + maxLength: 1000 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + ItemAttributeDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + descriptions: + type: array + items: + $ref: '#/components/schemas/ItemAttributeDescription' + readOnly: true + items: + type: string + readOnly: true + names: + type: array + items: + $ref: '#/components/schemas/ItemAttributeName' + readOnly: true + required: + - descriptions + - id + - items + - name + - names + ItemAttributeName: + type: object + properties: + name: + type: string + maxLength: 100 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + - name + ItemAttributeSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + ItemCategoryDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + items: + type: array + items: + $ref: '#/components/schemas/ItemSummary' + readOnly: true + names: + type: array + items: + $ref: '#/components/schemas/ItemCategoryName' + readOnly: true + pocket: + $ref: '#/components/schemas/ItemPocketSummary' + required: + - id + - items + - name + - names + - pocket + ItemCategoryName: + type: object + properties: + name: + type: string + maxLength: 100 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + - name + ItemCategorySummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + ItemDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + cost: + type: + - integer + - 'null' + maximum: 2147483647 + minimum: -2147483648 + fling_power: + type: + - integer + - 'null' + maximum: 2147483647 + minimum: -2147483648 + fling_effect: + $ref: '#/components/schemas/ItemFlingEffectSummary' + attributes: + type: string + readOnly: true + category: + $ref: '#/components/schemas/ItemCategorySummary' + effect_entries: + type: array + items: + $ref: '#/components/schemas/ItemEffectText' + readOnly: true + flavor_text_entries: + type: array + items: + $ref: '#/components/schemas/ItemFlavorText' + readOnly: true + game_indices: + type: array + items: + $ref: '#/components/schemas/ItemGameIndex' + readOnly: true + names: + type: array + items: + $ref: '#/components/schemas/ItemName' + readOnly: true + held_by_pokemon: + type: string + readOnly: true + sprites: + type: string + readOnly: true + baby_trigger_for: + type: string + readOnly: true + machines: + type: string + readOnly: true + required: + - attributes + - baby_trigger_for + - category + - effect_entries + - flavor_text_entries + - fling_effect + - game_indices + - held_by_pokemon + - id + - machines + - name + - names + - sprites + ItemEffectText: + type: object + properties: + effect: + type: string + maxLength: 6000 + short_effect: + type: string + maxLength: 300 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - effect + - language + - short_effect + ItemFlavorText: + type: object + properties: + text: + type: string + version_group: + $ref: '#/components/schemas/VersionGroupSummary' + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + - text + - version_group + ItemFlingEffectDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + effect_entries: + type: array + items: + $ref: '#/components/schemas/ItemFlingEffectEffectText' + readOnly: true + items: + type: array + items: + $ref: '#/components/schemas/ItemSummary' + readOnly: true + required: + - effect_entries + - id + - items + - name + ItemFlingEffectEffectText: + type: object + properties: + effect: + type: string + maxLength: 6000 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - effect + - language + ItemFlingEffectSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + ItemGameIndex: + type: object + properties: + game_index: + type: integer + maximum: 2147483647 + minimum: -2147483648 + generation: + $ref: '#/components/schemas/GenerationSummary' + required: + - game_index + - generation + ItemName: + type: object + properties: + name: + type: string + maxLength: 100 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + - name + ItemPocketDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + categories: + type: array + items: + $ref: '#/components/schemas/ItemCategorySummary' + readOnly: true + names: + type: array + items: + $ref: '#/components/schemas/ItemPocketName' + readOnly: true + required: + - categories + - id + - name + - names + ItemPocketName: + type: object + properties: + name: + type: string + maxLength: 100 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + - name + ItemPocketSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + ItemSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + LanguageDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + official: + type: boolean + iso639: + type: string + maxLength: 10 + iso3166: + type: string + maxLength: 2 + names: + type: array + items: + $ref: '#/components/schemas/LanguageName' + readOnly: true + required: + - id + - iso3166 + - iso639 + - name + - names + LanguageName: + type: object + properties: + name: + type: string + maxLength: 100 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + - name + LanguageSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + LocationAreaDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + game_index: + type: integer + maximum: 2147483647 + minimum: -2147483648 + encounter_method_rates: + type: string + readOnly: true + location: + $ref: '#/components/schemas/LocationSummary' + names: + type: array + items: + $ref: '#/components/schemas/LocationAreaName' + readOnly: true + pokemon_encounters: + type: string + readOnly: true + required: + - encounter_method_rates + - game_index + - id + - location + - name + - names + - pokemon_encounters + LocationAreaName: + type: object + properties: + name: + type: string + maxLength: 100 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + - name + LocationAreaSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + LocationDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + region: + $ref: '#/components/schemas/RegionSummary' + names: + type: array + items: + $ref: '#/components/schemas/LocationName' + readOnly: true + game_indices: + type: array + items: + $ref: '#/components/schemas/LocationGameIndex' + readOnly: true + areas: + type: array + items: + $ref: '#/components/schemas/LocationAreaSummary' + readOnly: true + required: + - areas + - game_indices + - id + - name + - names + - region + LocationGameIndex: + type: object + properties: + game_index: + type: integer + maximum: 2147483647 + minimum: -2147483648 + generation: + $ref: '#/components/schemas/GenerationSummary' + required: + - game_index + - generation + LocationName: + type: object + properties: + name: + type: string + maxLength: 100 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + - name + LocationSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + MachineDetail: + type: object + properties: + id: + type: integer + readOnly: true + item: + $ref: '#/components/schemas/ItemSummary' + version_group: + $ref: '#/components/schemas/VersionGroupSummary' + move: + $ref: '#/components/schemas/MoveSummary' + required: + - id + - item + - move + - version_group + MachineSummary: + type: object + properties: + url: + type: string + format: uri + readOnly: true + required: + - url + MoveBattleStyleDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + names: + type: array + items: + $ref: '#/components/schemas/MoveBattleStyleName' + readOnly: true + required: + - id + - name + - names + MoveBattleStyleName: + type: object + properties: + name: + type: string + maxLength: 100 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + - name + MoveBattleStyleSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + MoveChange: + type: object + properties: + accuracy: + type: + - integer + - 'null' + maximum: 2147483647 + minimum: -2147483648 + power: + type: + - integer + - 'null' + maximum: 2147483647 + minimum: -2147483648 + pp: + type: + - integer + - 'null' + maximum: 2147483647 + minimum: -2147483648 + effect_chance: + type: integer + effect_entries: + type: string + readOnly: true + type: + $ref: '#/components/schemas/TypeSummary' + version_group: + $ref: '#/components/schemas/VersionGroupSummary' + required: + - effect_chance + - effect_entries + - type + - version_group + MoveDamageClassDescription: + type: object + properties: + description: + type: string + maxLength: 1000 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + MoveDamageClassDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + descriptions: + type: array + items: + $ref: '#/components/schemas/MoveDamageClassDescription' + readOnly: true + moves: + type: array + items: + $ref: '#/components/schemas/MoveSummary' + readOnly: true + names: + type: array + items: + $ref: '#/components/schemas/MoveDamageClassName' + readOnly: true + required: + - descriptions + - id + - moves + - name + - names + MoveDamageClassName: + type: object + properties: + name: + type: string + maxLength: 100 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + - name + MoveDamageClassSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + MoveDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + accuracy: + type: + - integer + - 'null' + maximum: 2147483647 + minimum: -2147483648 + effect_chance: + type: integer + pp: + type: + - integer + - 'null' + maximum: 2147483647 + minimum: -2147483648 + priority: + type: + - integer + - 'null' + maximum: 2147483647 + minimum: -2147483648 + power: + type: + - integer + - 'null' + maximum: 2147483647 + minimum: -2147483648 + contest_combos: + type: string + readOnly: true + contest_type: + $ref: '#/components/schemas/ContestTypeSummary' + contest_effect: + $ref: '#/components/schemas/ContestEffectSummary' + damage_class: + $ref: '#/components/schemas/MoveDamageClassSummary' + effect_entries: + type: string + readOnly: true + effect_changes: + type: string + readOnly: true + generation: + $ref: '#/components/schemas/GenerationSummary' + meta: + allOf: + - $ref: '#/components/schemas/MoveMeta' + readOnly: true + names: + type: array + items: + $ref: '#/components/schemas/MoveName' + readOnly: true + past_values: + type: array + items: + $ref: '#/components/schemas/MoveChange' + readOnly: true + stat_changes: + type: string + readOnly: true + super_contest_effect: + $ref: '#/components/schemas/SuperContestEffectSummary' + target: + $ref: '#/components/schemas/MoveTargetSummary' + type: + $ref: '#/components/schemas/TypeSummary' + machines: + type: string + readOnly: true + flavor_text_entries: + type: array + items: + $ref: '#/components/schemas/MoveFlavorText' + readOnly: true + learned_by_pokemon: + type: string + readOnly: true + required: + - contest_combos + - contest_effect + - contest_type + - damage_class + - effect_chance + - effect_changes + - effect_entries + - flavor_text_entries + - generation + - id + - learned_by_pokemon + - machines + - meta + - name + - names + - past_values + - stat_changes + - super_contest_effect + - target + - type + MoveFlavorText: + type: object + properties: + flavor_text: + type: string + language: + $ref: '#/components/schemas/LanguageSummary' + version_group: + $ref: '#/components/schemas/VersionGroupSummary' + required: + - flavor_text + - language + - version_group + MoveLearnMethodDescription: + type: object + properties: + description: + type: string + maxLength: 1000 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + MoveLearnMethodDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + names: + type: array + items: + $ref: '#/components/schemas/MoveLearnMethodName' + readOnly: true + descriptions: + type: array + items: + $ref: '#/components/schemas/MoveLearnMethodDescription' + readOnly: true + version_groups: + type: string + readOnly: true + required: + - descriptions + - id + - name + - names + - version_groups + MoveLearnMethodName: + type: object + properties: + name: + type: string + maxLength: 100 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + - name + MoveLearnMethodSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + MoveMeta: + type: object + properties: + ailment: + $ref: '#/components/schemas/MoveMetaAilmentSummary' + category: + $ref: '#/components/schemas/MoveMetaCategorySummary' + min_hits: + type: + - integer + - 'null' + maximum: 2147483647 + minimum: -2147483648 + max_hits: + type: + - integer + - 'null' + maximum: 2147483647 + minimum: -2147483648 + min_turns: + type: + - integer + - 'null' + maximum: 2147483647 + minimum: -2147483648 + max_turns: + type: + - integer + - 'null' + maximum: 2147483647 + minimum: -2147483648 + drain: + type: + - integer + - 'null' + maximum: 2147483647 + minimum: -2147483648 + healing: + type: + - integer + - 'null' + maximum: 2147483647 + minimum: -2147483648 + crit_rate: + type: + - integer + - 'null' + maximum: 2147483647 + minimum: -2147483648 + ailment_chance: + type: + - integer + - 'null' + maximum: 2147483647 + minimum: -2147483648 + flinch_chance: + type: + - integer + - 'null' + maximum: 2147483647 + minimum: -2147483648 + stat_chance: + type: + - integer + - 'null' + maximum: 2147483647 + minimum: -2147483648 + required: + - ailment + - category + MoveMetaAilmentDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + moves: + type: string + readOnly: true + names: + type: array + items: + $ref: '#/components/schemas/MoveMetaAilmentName' + readOnly: true + required: + - id + - moves + - name + - names + MoveMetaAilmentName: + type: object + properties: + name: + type: string + maxLength: 100 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + - name + MoveMetaAilmentSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + MoveMetaCategoryDescription: + type: object + properties: + description: + type: string + maxLength: 1000 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + MoveMetaCategoryDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + descriptions: + type: array + items: + $ref: '#/components/schemas/MoveMetaCategoryDescription' + readOnly: true + moves: + type: string + readOnly: true + required: + - descriptions + - id + - moves + - name + MoveMetaCategorySummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + MoveName: + type: object + properties: + name: + type: string + maxLength: 100 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + - name + MoveSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + MoveTargetDescription: + type: object + properties: + description: + type: string + maxLength: 1000 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + MoveTargetDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + descriptions: + type: array + items: + $ref: '#/components/schemas/MoveTargetDescription' + readOnly: true + moves: + type: array + items: + $ref: '#/components/schemas/MoveSummary' + readOnly: true + names: + type: array + items: + $ref: '#/components/schemas/MoveTargetName' + readOnly: true + required: + - descriptions + - id + - moves + - name + - names + MoveTargetName: + type: object + properties: + name: + type: string + maxLength: 100 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + - name + MoveTargetSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + NatureBattleStylePreference: + type: object + properties: + low_hp_preference: + type: integer + maximum: 2147483647 + minimum: -2147483648 + high_hp_preference: + type: integer + maximum: 2147483647 + minimum: -2147483648 + move_battle_style: + $ref: '#/components/schemas/MoveBattleStyleSummary' + required: + - high_hp_preference + - low_hp_preference + - move_battle_style + NatureDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + decreased_stat: + $ref: '#/components/schemas/StatSummary' + increased_stat: + $ref: '#/components/schemas/StatSummary' + likes_flavor: + $ref: '#/components/schemas/BerryFlavorSummary' + hates_flavor: + $ref: '#/components/schemas/BerryFlavorSummary' + berries: + type: array + items: + $ref: '#/components/schemas/BerrySummary' + readOnly: true + pokeathlon_stat_changes: + type: string + readOnly: true + move_battle_style_preferences: + type: array + items: + $ref: '#/components/schemas/NatureBattleStylePreference' + readOnly: true + names: + type: array + items: + $ref: '#/components/schemas/NatureName' + readOnly: true + required: + - berries + - decreased_stat + - hates_flavor + - id + - increased_stat + - likes_flavor + - move_battle_style_preferences + - name + - names + - pokeathlon_stat_changes + NatureName: + type: object + properties: + name: + type: string + maxLength: 100 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + - name + NatureSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + PaginatedAbilitySummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/AbilitySummary' + PaginatedBerryFirmnessSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/BerryFirmnessSummary' + PaginatedBerryFlavorSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/BerryFlavorSummary' + PaginatedBerrySummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/BerrySummary' + PaginatedCharacteristicSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/CharacteristicSummary' + PaginatedContestEffectSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/ContestEffectSummary' + PaginatedContestTypeSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/ContestTypeSummary' + PaginatedEggGroupSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/EggGroupSummary' + PaginatedEncounterConditionSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/EncounterConditionSummary' + PaginatedEncounterConditionValueSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/EncounterConditionValueSummary' + PaginatedEncounterMethodSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/EncounterMethodSummary' + PaginatedEvolutionChainSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/EvolutionChainSummary' + PaginatedEvolutionTriggerSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/EvolutionTriggerSummary' + PaginatedGenderSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/GenderSummary' + PaginatedGenerationSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/GenerationSummary' + PaginatedGrowthRateSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/GrowthRateSummary' + PaginatedItemAttributeSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/ItemAttributeSummary' + PaginatedItemCategorySummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/ItemCategorySummary' + PaginatedItemFlingEffectSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/ItemFlingEffectSummary' + PaginatedItemPocketSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/ItemPocketSummary' + PaginatedItemSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/ItemSummary' + PaginatedLanguageSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/LanguageSummary' + PaginatedLocationAreaSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/LocationAreaSummary' + PaginatedLocationSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/LocationSummary' + PaginatedMachineSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/MachineSummary' + PaginatedMoveBattleStyleSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/MoveBattleStyleSummary' + PaginatedMoveDamageClassSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/MoveDamageClassSummary' + PaginatedMoveLearnMethodSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/MoveLearnMethodSummary' + PaginatedMoveMetaAilmentSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/MoveMetaAilmentSummary' + PaginatedMoveMetaCategorySummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/MoveMetaCategorySummary' + PaginatedMoveSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/MoveSummary' + PaginatedMoveTargetSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/MoveTargetSummary' + PaginatedNatureSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/NatureSummary' + PaginatedPalParkAreaSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/PalParkAreaSummary' + PaginatedPokeathlonStatSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/PokeathlonStatSummary' + PaginatedPokedexSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/PokedexSummary' + PaginatedPokemonColorSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/PokemonColorSummary' + PaginatedPokemonFormSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/PokemonFormSummary' + PaginatedPokemonHabitatSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/PokemonHabitatSummary' + PaginatedPokemonShapeSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/PokemonShapeSummary' + PaginatedPokemonSpeciesSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/PokemonSpeciesSummary' + PaginatedPokemonSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/PokemonSummary' + PaginatedRegionSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/RegionSummary' + PaginatedStatSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/StatSummary' + PaginatedSuperContestEffectSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/SuperContestEffectSummary' + PaginatedTypeSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/TypeSummary' + PaginatedVersionGroupSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/VersionGroupSummary' + PaginatedVersionSummaryList: + type: object + properties: + count: + type: integer + example: 123 + next: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=400&limit=100 + previous: + type: string + nullable: true + format: uri + example: http://api.example.org/accounts/?offset=200&limit=100 + results: + type: array + items: + $ref: '#/components/schemas/VersionSummary' + PalParkAreaDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + names: + type: array + items: + $ref: '#/components/schemas/PalParkAreaName' + readOnly: true + pokemon_encounters: + type: string + readOnly: true + required: + - id + - name + - names + - pokemon_encounters + PalParkAreaName: + type: object + properties: + name: + type: string + maxLength: 100 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + - name + PalParkAreaSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + PokeathlonStatDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + affecting_natures: + type: string + readOnly: true + names: + type: array + items: + $ref: '#/components/schemas/PokeathlonStatName' + readOnly: true + required: + - affecting_natures + - id + - name + - names + PokeathlonStatName: + type: object + properties: + name: + type: string + maxLength: 100 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + - name + PokeathlonStatSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + PokedexDescription: + type: object + properties: + description: + type: string + maxLength: 1000 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + PokedexDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + is_main_series: + type: boolean + descriptions: + type: array + items: + $ref: '#/components/schemas/PokedexDescription' + readOnly: true + names: + type: array + items: + $ref: '#/components/schemas/PokedexName' + readOnly: true + pokemon_entries: + type: string + readOnly: true + region: + $ref: '#/components/schemas/RegionSummary' + version_groups: + type: string + readOnly: true + required: + - descriptions + - id + - name + - names + - pokemon_entries + - region + - version_groups + PokedexName: + type: object + properties: + name: + type: string + maxLength: 100 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + - name + PokedexSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + PokemonColorDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + names: + type: array + items: + $ref: '#/components/schemas/PokemonColorName' + readOnly: true + pokemon_species: + type: array + items: + $ref: '#/components/schemas/PokemonSpeciesSummary' + readOnly: true + required: + - id + - name + - names + - pokemon_species + PokemonColorName: + type: object + properties: + name: + type: string + maxLength: 100 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + - name + PokemonColorSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + PokemonDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + base_experience: + type: + - integer + - 'null' + maximum: 2147483647 + minimum: -2147483648 + height: + type: + - integer + - 'null' + maximum: 2147483647 + minimum: -2147483648 + is_default: + type: boolean + order: + type: + - integer + - 'null' + maximum: 2147483647 + minimum: -2147483648 + weight: + type: + - integer + - 'null' + maximum: 2147483647 + minimum: -2147483648 + abilities: + type: string + readOnly: true + past_abilities: + type: string + readOnly: true + forms: + type: array + items: + $ref: '#/components/schemas/PokemonFormSummary' + readOnly: true + game_indices: + type: array + items: + $ref: '#/components/schemas/PokemonGameIndex' + readOnly: true + held_items: + type: string + readOnly: true + location_area_encounters: + type: string + readOnly: true + moves: + type: string + readOnly: true + species: + $ref: '#/components/schemas/PokemonSpeciesSummary' + sprites: + type: string + readOnly: true + cries: + type: string + readOnly: true + stats: + type: array + items: + $ref: '#/components/schemas/PokemonStat' + readOnly: true + types: + type: string + readOnly: true + past_types: + type: string + readOnly: true + required: + - abilities + - cries + - forms + - game_indices + - held_items + - id + - location_area_encounters + - moves + - name + - past_abilities + - past_types + - species + - sprites + - stats + - types + PokemonDexEntry: + type: object + properties: + entry_number: + type: integer + pokedex: + $ref: '#/components/schemas/PokedexSummary' + required: + - entry_number + - pokedex + PokemonFormDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + order: + type: + - integer + - 'null' + maximum: 2147483647 + minimum: -2147483648 + form_order: + type: + - integer + - 'null' + maximum: 2147483647 + minimum: -2147483648 + is_default: + type: boolean + is_battle_only: + type: boolean + is_mega: + type: boolean + form_name: + type: string + maxLength: 30 + pokemon: + $ref: '#/components/schemas/PokemonSummary' + sprites: + type: string + readOnly: true + version_group: + $ref: '#/components/schemas/VersionGroupSummary' + form_names: + type: string + readOnly: true + names: + type: string + readOnly: true + types: + type: string + readOnly: true + required: + - form_name + - form_names + - id + - name + - names + - pokemon + - sprites + - types + - version_group + PokemonFormSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + PokemonGameIndex: + type: object + properties: + game_index: + type: integer + maximum: 2147483647 + minimum: -2147483648 + version: + $ref: '#/components/schemas/VersionSummary' + required: + - game_index + - version + PokemonHabitatDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + names: + type: array + items: + $ref: '#/components/schemas/PokemonHabitatName' + readOnly: true + pokemon_species: + type: array + items: + $ref: '#/components/schemas/PokemonSpeciesSummary' + readOnly: true + required: + - id + - name + - names + - pokemon_species + PokemonHabitatName: + type: object + properties: + name: + type: string + maxLength: 100 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + - name + PokemonHabitatSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + PokemonShapeDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + awesome_names: + type: string + readOnly: true + names: + type: string + readOnly: true + pokemon_species: + type: array + items: + $ref: '#/components/schemas/PokemonSpeciesSummary' + readOnly: true + required: + - awesome_names + - id + - name + - names + - pokemon_species + PokemonShapeSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + PokemonSpeciesDescription: + type: object + properties: + description: + type: string + maxLength: 1000 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + PokemonSpeciesDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + order: + type: + - integer + - 'null' + maximum: 2147483647 + minimum: -2147483648 + gender_rate: + type: + - integer + - 'null' + maximum: 2147483647 + minimum: -2147483648 + capture_rate: + type: + - integer + - 'null' + maximum: 2147483647 + minimum: -2147483648 + base_happiness: + type: + - integer + - 'null' + maximum: 2147483647 + minimum: -2147483648 + is_baby: + type: boolean + is_legendary: + type: boolean + is_mythical: + type: boolean + hatch_counter: + type: + - integer + - 'null' + maximum: 2147483647 + minimum: -2147483648 + has_gender_differences: + type: boolean + forms_switchable: + type: boolean + growth_rate: + $ref: '#/components/schemas/GrowthRateSummary' + pokedex_numbers: + type: array + items: + $ref: '#/components/schemas/PokemonDexEntry' + readOnly: true + egg_groups: + type: string + readOnly: true + color: + $ref: '#/components/schemas/PokemonColorSummary' + shape: + $ref: '#/components/schemas/PokemonShapeSummary' + evolves_from_species: + $ref: '#/components/schemas/PokemonSpeciesSummary' + evolution_chain: + $ref: '#/components/schemas/EvolutionChainSummary' + habitat: + $ref: '#/components/schemas/PokemonHabitatSummary' + generation: + $ref: '#/components/schemas/GenerationSummary' + names: + type: string + readOnly: true + pal_park_encounters: + type: string + readOnly: true + form_descriptions: + type: array + items: + $ref: '#/components/schemas/PokemonSpeciesDescription' + readOnly: true + flavor_text_entries: + type: array + items: + $ref: '#/components/schemas/PokemonSpeciesFlavorText' + readOnly: true + genera: + type: string + readOnly: true + varieties: + type: string + readOnly: true + required: + - color + - egg_groups + - evolution_chain + - evolves_from_species + - flavor_text_entries + - form_descriptions + - genera + - generation + - growth_rate + - habitat + - id + - name + - names + - pal_park_encounters + - pokedex_numbers + - shape + - varieties + PokemonSpeciesFlavorText: + type: object + properties: + flavor_text: + type: string + language: + $ref: '#/components/schemas/LanguageSummary' + version: + $ref: '#/components/schemas/VersionSummary' + required: + - flavor_text + - language + - version + PokemonSpeciesSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + PokemonStat: + type: object + properties: + base_stat: + type: integer + maximum: 2147483647 + minimum: -2147483648 + effort: + type: integer + maximum: 2147483647 + minimum: -2147483648 + stat: + $ref: '#/components/schemas/StatSummary' + required: + - base_stat + - effort + - stat + PokemonSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + RegionDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + locations: + type: array + items: + $ref: '#/components/schemas/LocationSummary' + readOnly: true + main_generation: + allOf: + - $ref: '#/components/schemas/GenerationSummary' + readOnly: true + names: + type: array + items: + $ref: '#/components/schemas/RegionName' + readOnly: true + pokedexes: + type: array + items: + $ref: '#/components/schemas/PokedexSummary' + readOnly: true + version_groups: + type: string + readOnly: true + required: + - id + - locations + - main_generation + - name + - names + - pokedexes + - version_groups + RegionName: + type: object + properties: + name: + type: string + maxLength: 100 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + - name + RegionSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + StatDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + game_index: + type: integer + maximum: 2147483647 + minimum: -2147483648 + is_battle_only: + type: boolean + affecting_moves: + type: string + readOnly: true + affecting_natures: + type: string + readOnly: true + characteristics: + type: array + items: + $ref: '#/components/schemas/CharacteristicSummary' + readOnly: true + move_damage_class: + $ref: '#/components/schemas/MoveDamageClassSummary' + names: + type: array + items: + $ref: '#/components/schemas/StatName' + readOnly: true + required: + - affecting_moves + - affecting_natures + - characteristics + - game_index + - id + - move_damage_class + - name + - names + StatName: + type: object + properties: + name: + type: string + maxLength: 100 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + - name + StatSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + SuperContestEffectDetail: + type: object + properties: + id: + type: integer + readOnly: true + appeal: + type: integer + maximum: 2147483647 + minimum: -2147483648 + flavor_text_entries: + type: array + items: + $ref: '#/components/schemas/SuperContestEffectFlavorText' + readOnly: true + moves: + type: array + items: + $ref: '#/components/schemas/MoveSummary' + readOnly: true + required: + - appeal + - flavor_text_entries + - id + - moves + SuperContestEffectFlavorText: + type: object + properties: + flavor_text: + type: string + maxLength: 500 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - flavor_text + - language + SuperContestEffectSummary: + type: object + properties: + url: + type: string + format: uri + readOnly: true + required: + - url + TypeDetail: + type: object + description: Serializer for the Type resource + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + damage_relations: + type: string + readOnly: true + past_damage_relations: + type: string + readOnly: true + game_indices: + type: array + items: + $ref: '#/components/schemas/TypeGameIndex' + readOnly: true + generation: + $ref: '#/components/schemas/GenerationSummary' + move_damage_class: + $ref: '#/components/schemas/MoveDamageClassSummary' + names: + type: array + items: + $ref: '#/components/schemas/AbilityName' + readOnly: true + pokemon: + type: string + readOnly: true + moves: + type: array + items: + $ref: '#/components/schemas/MoveSummary' + readOnly: true + required: + - damage_relations + - game_indices + - generation + - id + - move_damage_class + - moves + - name + - names + - past_damage_relations + - pokemon + TypeGameIndex: + type: object + properties: + game_index: + type: integer + maximum: 2147483647 + minimum: -2147483648 + generation: + $ref: '#/components/schemas/GenerationSummary' + required: + - game_index + - generation + TypeSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + VersionDetail: + type: object + description: |- + Should have a link to Version Group info but the Circular + dependency and compilation order fight eachother and I'm + not sure how to add anything other than a hyperlink + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + names: + type: array + items: + $ref: '#/components/schemas/VersionName' + readOnly: true + version_group: + $ref: '#/components/schemas/VersionGroupSummary' + required: + - id + - name + - names + - version_group + VersionGroupDetail: + type: object + properties: + id: + type: integer + readOnly: true + name: + type: string + maxLength: 100 + order: + type: + - integer + - 'null' + maximum: 2147483647 + minimum: -2147483648 + generation: + $ref: '#/components/schemas/GenerationSummary' + move_learn_methods: + type: string + readOnly: true + pokedexes: + type: string + readOnly: true + regions: + type: string + readOnly: true + versions: + type: array + items: + $ref: '#/components/schemas/VersionSummary' + readOnly: true + required: + - generation + - id + - move_learn_methods + - name + - pokedexes + - regions + - versions + VersionGroupSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + VersionName: + type: object + properties: + name: + type: string + maxLength: 100 + language: + $ref: '#/components/schemas/LanguageSummary' + required: + - language + - name + VersionSummary: + type: object + properties: + name: + type: string + maxLength: 100 + url: + type: string + format: uri + readOnly: true + required: + - name + - url + securitySchemes: + basicAuth: + type: http + scheme: basic + cookieAuth: + type: apiKey + in: cookie + name: sessionid +servers: +- url: https://pokeapi.co +externalDocs: + url: https://pokeapi.co/docs/v2 From c2d34ea6376da914096e5000b6c28f75140fd248 Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Sat, 24 Feb 2024 02:12:51 -0600 Subject: [PATCH 12/49] ci: add `nix-shell` --- default.nix | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 default.nix diff --git a/default.nix b/default.nix new file mode 100644 index 000000000..1775fe381 --- /dev/null +++ b/default.nix @@ -0,0 +1,41 @@ +with import { }; + +let + pythonPackages = python3Packages; +in pkgs.mkShell rec { + name = "impurePythonEnv"; + venvDir = "./.venv"; + buildInputs = [ + python310Packages.python + python310Packages.venvShellHook + + # python310Packages.coverage + # python310Packages.python-mimeparse + # python310Packages.python-dateutil + # python310Packages.drf-spectacular + # python310Packages.djangorestframework + # python310Packages.django-redis + # python310Packages.django-cors-headers + + # Required dependancies + taglib + openssl + git + libxml2 + libxslt + libzip + zlib + ]; + + # Run this command, only after creating the virtual environment + postVenvCreation = '' + unset SOURCE_DATE_EPOCH + pip install -r requirements.txt + ''; + + postShellHook = '' + # allow pip to install wheels + unset SOURCE_DATE_EPOCH + ''; + +} From 0e51181c14dff155d8747b2d59feaf6b25f6b059 Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Sun, 25 Feb 2024 23:56:18 -0600 Subject: [PATCH 13/49] docs(openapi): add operation descriptions --- pokemon_v2/api.py | 53 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 3 deletions(-) diff --git a/pokemon_v2/api.py b/pokemon_v2/api.py index 790f62b93..c2f443863 100644 --- a/pokemon_v2/api.py +++ b/pokemon_v2/api.py @@ -4,6 +4,7 @@ from rest_framework.views import APIView from django.shortcuts import get_object_or_404 from django.http import Http404 +from drf_spectacular.utils import extend_schema from .models import * from .serializers import * @@ -70,298 +71,344 @@ class PokeapiCommonViewset( ########## +@extend_schema(description='Abilities provide passive effects for Pokémon in battle or in the overworld. Pokémon have multiple possible abilities but can have only one ability at a time. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Ability) for greater detail.') class AbilityResource(PokeapiCommonViewset): queryset = Ability.objects.all() serializer_class = AbilityDetailSerializer list_serializer_class = AbilitySummarySerializer +@extend_schema(description='Berries are small fruits that can provide HP and status condition restoration, stat enhancement, and even damage negation when eaten by Pokémon. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Berry) for greater detail.') class BerryResource(PokeapiCommonViewset): queryset = Berry.objects.all() serializer_class = BerryDetailSerializer list_serializer_class = BerrySummarySerializer +@extend_schema(description='Berries can be soft or hard. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Category:Berries_by_firmness) for greater detail.') class BerryFirmnessResource(PokeapiCommonViewset): queryset = BerryFirmness.objects.all() serializer_class = BerryFirmnessDetailSerializer list_serializer_class = BerryFirmnessSummarySerializer +@extend_schema(description='Flavors determine whether a Pokémon will benefit or suffer from eating a berry based on their **nature**. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Flavor) for greater detail.') class BerryFlavorResource(PokeapiCommonViewset): queryset = BerryFlavor.objects.all() serializer_class = BerryFlavorDetailSerializer list_serializer_class = BerryFlavorSummarySerializer +@extend_schema(description='Characteristics indicate which stat contains a Pokémon\'s highest IV. A Pokémon\'s Characteristic is determined by the remainder of its highest IV divided by 5 (gene_modulo). Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Characteristic) for greater detail.') class CharacteristicResource(PokeapiCommonViewset): queryset = Characteristic.objects.all() serializer_class = CharacteristicDetailSerializer list_serializer_class = CharacteristicSummarySerializer +@extend_schema(description='Contest effects refer to the effects of moves when used in contests.') class ContestEffectResource(PokeapiCommonViewset): queryset = ContestEffect.objects.all() serializer_class = ContestEffectDetailSerializer list_serializer_class = ContestEffectSummarySerializer +@extend_schema(description='Contest types are categories judges used to weigh a Pokémon\'s condition in Pokémon contests. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Contest_condition) for greater detail.') class ContestTypeResource(PokeapiCommonViewset): queryset = ContestType.objects.all() serializer_class = ContestTypeDetailSerializer list_serializer_class = ContestTypeSummarySerializer +@extend_schema(description='Egg Groups are categories which determine which Pokémon are able to interbreed. Pokémon may belong to either one or two Egg Groups. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Egg_Group) for greater detail.') class EggGroupResource(PokeapiCommonViewset): queryset = EggGroup.objects.all() serializer_class = EggGroupDetailSerializer list_serializer_class = EggGroupSummarySerializer +@extend_schema(description='Conditions which affect what pokemon might appear in the wild, e.g., day or night.') class EncounterConditionResource(PokeapiCommonViewset): queryset = EncounterCondition.objects.all() serializer_class = EncounterConditionDetailSerializer list_serializer_class = EncounterConditionSummarySerializer +@extend_schema(description='Encounter condition values are the various states that an encounter condition can have, i.e., time of day can be either day or night.') class EncounterConditionValueResource(PokeapiCommonViewset): queryset = EncounterConditionValue.objects.all() serializer_class = EncounterConditionValueDetailSerializer list_serializer_class = EncounterConditionValueSummarySerializer +@extend_schema(description='Methods by which the player might can encounter Pokémon in the wild, e.g., walking in tall grass. Check out Bulbapedia for greater detail.') class EncounterMethodResource(PokeapiCommonViewset): queryset = EncounterMethod.objects.all() serializer_class = EncounterMethodDetailSerializer list_serializer_class = EncounterMethodSummarySerializer +@extend_schema(description='Evolution chains are essentially family trees. They start with the lowest stage within a family and detail evolution conditions for each as well as Pokémon they can evolve into up through the hierarchy.') class EvolutionChainResource(PokeapiCommonViewset): queryset = EvolutionChain.objects.all() serializer_class = EvolutionChainDetailSerializer list_serializer_class = EvolutionChainSummarySerializer +@extend_schema(description='Evolution triggers are the events and conditions that cause a Pokémon to evolve. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Methods_of_evolution) for greater detail.') class EvolutionTriggerResource(PokeapiCommonViewset): queryset = EvolutionTrigger.objects.all() serializer_class = EvolutionTriggerDetailSerializer list_serializer_class = EvolutionTriggerSummarySerializer +@extend_schema(description='A generation is a grouping of the Pokémon games that separates them based on the Pokémon they include. In each generation, a new set of Pokémon, Moves, Abilities and Types that did not exist in the previous generation are released.') class GenerationResource(PokeapiCommonViewset): queryset = Generation.objects.all() serializer_class = GenerationDetailSerializer list_serializer_class = GenerationSummarySerializer +@extend_schema(description='Genders were introduced in Generation II for the purposes of breeding Pokémon but can also result in visual differences or even different evolutionary lines. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Gender) for greater detail.') class GenderResource(PokeapiCommonViewset): queryset = Gender.objects.all() serializer_class = GenderDetailSerializer list_serializer_class = GenderSummarySerializer +@extend_schema(description='Growth rates are the speed with which Pokémon gain levels through experience. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Experience) for greater detail.') class GrowthRateResource(PokeapiCommonViewset): queryset = GrowthRate.objects.all() serializer_class = GrowthRateDetailSerializer list_serializer_class = GrowthRateSummarySerializer +@extend_schema(description='An item is an object in the games which the player can pick up, keep in their bag, and use in some manner. They have various uses, including healing, powering up, helping catch Pokémon, or to access a new area.') class ItemResource(PokeapiCommonViewset): queryset = Item.objects.all() serializer_class = ItemDetailSerializer list_serializer_class = ItemSummarySerializer +@extend_schema(description='Item categories determine where items will be placed in the players bag.') class ItemCategoryResource(PokeapiCommonViewset): queryset = ItemCategory.objects.all() serializer_class = ItemCategoryDetailSerializer list_serializer_class = ItemCategorySummarySerializer +@extend_schema(description='Item attributes define particular aspects of items, e.g."usable in battle" or "consumable".') class ItemAttributeResource(PokeapiCommonViewset): queryset = ItemAttribute.objects.all() serializer_class = ItemAttributeDetailSerializer list_serializer_class = ItemAttributeSummarySerializer +@extend_schema(description='The various effects of the move"Fling" when used with different items.') class ItemFlingEffectResource(PokeapiCommonViewset): queryset = ItemFlingEffect.objects.all() serializer_class = ItemFlingEffectDetailSerializer list_serializer_class = ItemFlingEffectSummarySerializer +@extend_schema(description='Pockets within the players bag used for storing items by category.') class ItemPocketResource(PokeapiCommonViewset): queryset = ItemPocket.objects.all() serializer_class = ItemPocketDetailSerializer list_serializer_class = ItemPocketSummarySerializer +@extend_schema(description='Languages for translations of API resource information.') class LanguageResource(PokeapiCommonViewset): queryset = Language.objects.all() serializer_class = LanguageDetailSerializer list_serializer_class = LanguageSummarySerializer +@extend_schema(description='Locations that can be visited within the games. Locations make up sizable portions of regions, like cities or routes.') class LocationResource(PokeapiCommonViewset): queryset = Location.objects.all() serializer_class = LocationDetailSerializer list_serializer_class = LocationSummarySerializer +@extend_schema(description='Location areas are sections of areas, such as floors in a building or cave. Each area has its own set of possible Pokémon encounters.') class LocationAreaResource(ListOrDetailSerialRelation, viewsets.ReadOnlyModelViewSet): queryset = LocationArea.objects.all() serializer_class = LocationAreaDetailSerializer list_serializer_class = LocationAreaSummarySerializer +@extend_schema(description='Machines are the representation of items that teach moves to Pokémon. They vary from version to version, so it is not certain that one specific TM or HM corresponds to a single Machine.') class MachineResource(PokeapiCommonViewset): queryset = Machine.objects.all() serializer_class = MachineDetailSerializer list_serializer_class = MachineSummarySerializer +@extend_schema(description='Moves are the skills of Pokémon in battle. In battle, a Pokémon uses one move each turn. Some moves (including those learned by Hidden Machine) can be used outside of battle as well, usually for the purpose of removing obstacles or exploring new areas.') class MoveResource(PokeapiCommonViewset): queryset = Move.objects.all() serializer_class = MoveDetailSerializer list_serializer_class = MoveSummarySerializer +@extend_schema(description='Damage classes moves can have, e.g. physical, special, or non-damaging.') class MoveDamageClassResource(PokeapiCommonViewset): queryset = MoveDamageClass.objects.all() serializer_class = MoveDamageClassDetailSerializer list_serializer_class = MoveDamageClassSummarySerializer +@extend_schema(description='Move Ailments are status conditions caused by moves used during battle. See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Status_condition) for greater detail.') class MoveMetaAilmentResource(PokeapiCommonViewset): queryset = MoveMetaAilment.objects.all() serializer_class = MoveMetaAilmentDetailSerializer list_serializer_class = MoveMetaAilmentSummarySerializer +@extend_schema(description='Styles of moves when used in the Battle Palace. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Battle_Frontier_(Generation_III)) for greater detail.') class MoveBattleStyleResource(PokeapiCommonViewset): queryset = MoveBattleStyle.objects.all() serializer_class = MoveBattleStyleDetailSerializer list_serializer_class = MoveBattleStyleSummarySerializer +@extend_schema(description='Very general categories that loosely group move effects.') class MoveMetaCategoryResource(PokeapiCommonViewset): queryset = MoveMetaCategory.objects.all() serializer_class = MoveMetaCategoryDetailSerializer list_serializer_class = MoveMetaCategorySummarySerializer +@extend_schema(description='Methods by which Pokémon can learn moves.') class MoveLearnMethodResource(PokeapiCommonViewset): queryset = MoveLearnMethod.objects.all() serializer_class = MoveLearnMethodDetailSerializer list_serializer_class = MoveLearnMethodSummarySerializer +@extend_schema(description='Targets moves can be directed at during battle. Targets can be Pokémon, environments or even other moves.') class MoveTargetResource(PokeapiCommonViewset): queryset = MoveTarget.objects.all() serializer_class = MoveTargetDetailSerializer list_serializer_class = MoveTargetSummarySerializer +@extend_schema(description='Natures influence how a Pokémon\'s stats grow. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Nature) for greater detail.') class NatureResource(PokeapiCommonViewset): queryset = Nature.objects.all() serializer_class = NatureDetailSerializer list_serializer_class = NatureSummarySerializer +@extend_schema(description='Areas used for grouping Pokémon encounters in Pal Park. They\'re like habitats that are specific to Pal Park.') class PalParkAreaResource(PokeapiCommonViewset): queryset = PalParkArea.objects.all() serializer_class = PalParkAreaDetailSerializer list_serializer_class = PalParkAreaSummarySerializer +@extend_schema(description='Pokeathlon Stats are different attributes of a Pokémon\'s performance in Pokéathlons. In Pokéathlons, competitions happen on different courses; one for each of the different Pokéathlon stats. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9athlon) for greater detail.') class PokeathlonStatResource(PokeapiCommonViewset): queryset = PokeathlonStat.objects.all() serializer_class = PokeathlonStatDetailSerializer list_serializer_class = PokeathlonStatSummarySerializer +@extend_schema(description='A Pokédex is a handheld electronic encyclopedia device; one which is capable of recording and retaining information of the various Pokémon in a given region with the exception of the national dex and some smaller dexes related to portions of a region. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Pokedex) for greater detail.') class PokedexResource(PokeapiCommonViewset): queryset = Pokedex.objects.all() serializer_class = PokedexDetailSerializer list_serializer_class = PokedexSummarySerializer +@extend_schema(description='Colors used for sorting Pokémon in a Pokédex. The color listed in the Pokédex is usually the color most apparent or covering each Pokémon\'s body. No orange category exists; Pokémon that are primarily orange are listed as red or brown.') class PokemonColorResource(PokeapiCommonViewset): queryset = PokemonColor.objects.all() serializer_class = PokemonColorDetailSerializer list_serializer_class = PokemonColorSummarySerializer +@extend_schema(description='Some Pokémon may appear in one of multiple, visually different forms. These differences are purely cosmetic. For variations within a Pokémon species, which do differ in more than just visuals, the \'Pokémon\' entity is used to represent such a variety.') class PokemonFormResource(PokeapiCommonViewset): queryset = PokemonForm.objects.all() serializer_class = PokemonFormDetailSerializer list_serializer_class = PokemonFormSummarySerializer +@extend_schema(description='Habitats are generally different terrain Pokémon can be found in but can also be areas designated for rare or legendary Pokémon.') class PokemonHabitatResource(PokeapiCommonViewset): queryset = PokemonHabitat.objects.all() serializer_class = PokemonHabitatDetailSerializer list_serializer_class = PokemonHabitatSummarySerializer +@extend_schema(description='Shapes used for sorting Pokémon in a Pokédex.') class PokemonShapeResource(PokeapiCommonViewset): queryset = PokemonShape.objects.all() serializer_class = PokemonShapeDetailSerializer list_serializer_class = PokemonShapeSummarySerializer +@extend_schema(description='Pokémon are the creatures that inhabit the world of the Pokémon games. They can be caught using Pokéballs and trained by battling with other Pokémon. Each Pokémon belongs to a specific species but may take on a variant which makes it differ from other Pokémon of the same species, such as base stats, available abilities and typings. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9mon_(species)) for greater detail.') class PokemonResource(PokeapiCommonViewset): queryset = Pokemon.objects.all() serializer_class = PokemonDetailSerializer list_serializer_class = PokemonSummarySerializer +@extend_schema(description='A Pokémon Species forms the basis for at least one Pokémon. Attributes of a Pokémon species are shared across all varieties of Pokémon within the species. A good example is Wormadam; Wormadam is the species which can be found in three different varieties, Wormadam-Trash, Wormadam-Sandy and Wormadam-Plant.') class PokemonSpeciesResource(PokeapiCommonViewset): queryset = PokemonSpecies.objects.all().order_by("id") serializer_class = PokemonSpeciesDetailSerializer list_serializer_class = PokemonSpeciesSummarySerializer +@extend_schema(description='A region is an organized area of the Pokémon world. Most often, the main difference between regions is the species of Pokémon that can be encountered within them.') class RegionResource(PokeapiCommonViewset): queryset = Region.objects.all() serializer_class = RegionDetailSerializer list_serializer_class = RegionSummarySerializer +@extend_schema(description='Stats determine certain aspects of battles. Each Pokémon has a value for each stat which grows as they gain levels and can be altered momentarily by effects in battles.') class StatResource(PokeapiCommonViewset): queryset = Stat.objects.all() serializer_class = StatDetailSerializer list_serializer_class = StatSummarySerializer +@extend_schema(description='Super contest effects refer to the effects of moves when used in super contests.') class SuperContestEffectResource(PokeapiCommonViewset): queryset = SuperContestEffect.objects.all() serializer_class = SuperContestEffectDetailSerializer list_serializer_class = SuperContestEffectSummarySerializer +@extend_schema(description='Types are properties for Pokémon and their moves. Each type has three properties: which types of Pokémon it is super effective against, which types of Pokémon it is not very effective against, and which types of Pokémon it is completely ineffective against.') class TypeResource(PokeapiCommonViewset): queryset = Type.objects.all() serializer_class = TypeDetailSerializer list_serializer_class = TypeSummarySerializer +@extend_schema(description='Versions of the games, e.g., Red, Blue or Yellow.') class VersionResource(PokeapiCommonViewset): queryset = Version.objects.all() serializer_class = VersionDetailSerializer list_serializer_class = VersionSummarySerializer +@extend_schema(description='Version groups categorize highly similar versions of the games.') class VersionGroupResource(PokeapiCommonViewset): queryset = VersionGroup.objects.all() serializer_class = VersionGroupDetailSerializer list_serializer_class = VersionGroupSummarySerializer +@extend_schema(description='Handles Pokemon Encounters as a sub-resource.') class PokemonEncounterView(APIView): - """ - Handles Pokemon Encounters as a sub-resource. - """ def get(self, request, pokemon_id): self.context = dict(request=request) From 9085223ae41d3646d681d541f7f78211528237a1 Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Mon, 26 Feb 2024 00:11:49 -0600 Subject: [PATCH 14/49] docs(openapi): update `openapi.yml` --- openapi.yml | 544 +++++++++++++++++++++++++--------------------------- 1 file changed, 256 insertions(+), 288 deletions(-) diff --git a/openapi.yml b/openapi.yml index d09e5a431..69910fdaf 100644 --- a/openapi.yml +++ b/openapi.yml @@ -7,9 +7,10 @@ paths: /api/v2/ability/: get: operationId: ability_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Abilities provide passive effects for Pokémon in battle or in the + overworld. Pokémon have multiple possible abilities but can have only one + ability at a time. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Ability) + for greater detail. parameters: - name: limit required: false @@ -39,9 +40,10 @@ paths: /api/v2/ability/{id}/: get: operationId: ability_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Abilities provide passive effects for Pokémon in battle or in the + overworld. Pokémon have multiple possible abilities but can have only one + ability at a time. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Ability) + for greater detail. parameters: - in: path name: id @@ -65,9 +67,10 @@ paths: /api/v2/berry/: get: operationId: berry_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Berries are small fruits that can provide HP and status condition + restoration, stat enhancement, and even damage negation when eaten by Pokémon. + Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Berry) for greater + detail. parameters: - name: limit required: false @@ -97,9 +100,8 @@ paths: /api/v2/berry-firmness/: get: operationId: berry_firmness_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Berries can be soft or hard. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Category:Berries_by_firmness) + for greater detail. parameters: - name: limit required: false @@ -129,9 +131,8 @@ paths: /api/v2/berry-firmness/{id}/: get: operationId: berry_firmness_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Berries can be soft or hard. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Category:Berries_by_firmness) + for greater detail. parameters: - in: path name: id @@ -155,9 +156,9 @@ paths: /api/v2/berry-flavor/: get: operationId: berry_flavor_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Flavors determine whether a Pokémon will benefit or suffer from + eating a berry based on their **nature**. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Flavor) + for greater detail. parameters: - name: limit required: false @@ -187,9 +188,9 @@ paths: /api/v2/berry-flavor/{id}/: get: operationId: berry_flavor_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Flavors determine whether a Pokémon will benefit or suffer from + eating a berry based on their **nature**. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Flavor) + for greater detail. parameters: - in: path name: id @@ -213,9 +214,10 @@ paths: /api/v2/berry/{id}/: get: operationId: berry_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Berries are small fruits that can provide HP and status condition + restoration, stat enhancement, and even damage negation when eaten by Pokémon. + Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Berry) for greater + detail. parameters: - in: path name: id @@ -239,9 +241,10 @@ paths: /api/v2/characteristic/: get: operationId: characteristic_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Characteristics indicate which stat contains a Pokémon's highest + IV. A Pokémon's Characteristic is determined by the remainder of its highest + IV divided by 5 (gene_modulo). Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Characteristic) + for greater detail. parameters: - name: limit required: false @@ -271,9 +274,10 @@ paths: /api/v2/characteristic/{id}/: get: operationId: characteristic_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Characteristics indicate which stat contains a Pokémon's highest + IV. A Pokémon's Characteristic is determined by the remainder of its highest + IV divided by 5 (gene_modulo). Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Characteristic) + for greater detail. parameters: - in: path name: id @@ -297,9 +301,7 @@ paths: /api/v2/contest-effect/: get: operationId: contest_effect_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Contest effects refer to the effects of moves when used in contests. parameters: - name: limit required: false @@ -329,9 +331,7 @@ paths: /api/v2/contest-effect/{id}/: get: operationId: contest_effect_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Contest effects refer to the effects of moves when used in contests. parameters: - in: path name: id @@ -355,9 +355,9 @@ paths: /api/v2/contest-type/: get: operationId: contest_type_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Contest types are categories judges used to weigh a Pokémon's condition + in Pokémon contests. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Contest_condition) + for greater detail. parameters: - name: limit required: false @@ -387,9 +387,9 @@ paths: /api/v2/contest-type/{id}/: get: operationId: contest_type_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Contest types are categories judges used to weigh a Pokémon's condition + in Pokémon contests. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Contest_condition) + for greater detail. parameters: - in: path name: id @@ -413,9 +413,10 @@ paths: /api/v2/egg-group/: get: operationId: egg_group_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Egg Groups are categories which determine which Pokémon are able + to interbreed. Pokémon may belong to either one or two Egg Groups. Check out + [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Egg_Group) for greater + detail. parameters: - name: limit required: false @@ -445,9 +446,10 @@ paths: /api/v2/egg-group/{id}/: get: operationId: egg_group_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Egg Groups are categories which determine which Pokémon are able + to interbreed. Pokémon may belong to either one or two Egg Groups. Check out + [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Egg_Group) for greater + detail. parameters: - in: path name: id @@ -471,9 +473,8 @@ paths: /api/v2/encounter-condition/: get: operationId: encounter_condition_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Conditions which affect what pokemon might appear in the wild, + e.g., day or night. parameters: - name: limit required: false @@ -503,9 +504,8 @@ paths: /api/v2/encounter-condition-value/: get: operationId: encounter_condition_value_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Encounter condition values are the various states that an encounter + condition can have, i.e., time of day can be either day or night. parameters: - name: limit required: false @@ -535,9 +535,8 @@ paths: /api/v2/encounter-condition-value/{id}/: get: operationId: encounter_condition_value_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Encounter condition values are the various states that an encounter + condition can have, i.e., time of day can be either day or night. parameters: - in: path name: id @@ -561,9 +560,8 @@ paths: /api/v2/encounter-condition/{id}/: get: operationId: encounter_condition_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Conditions which affect what pokemon might appear in the wild, + e.g., day or night. parameters: - in: path name: id @@ -587,9 +585,8 @@ paths: /api/v2/encounter-method/: get: operationId: encounter_method_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Methods by which the player might can encounter Pokémon in the + wild, e.g., walking in tall grass. Check out Bulbapedia for greater detail. parameters: - name: limit required: false @@ -619,9 +616,8 @@ paths: /api/v2/encounter-method/{id}/: get: operationId: encounter_method_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Methods by which the player might can encounter Pokémon in the + wild, e.g., walking in tall grass. Check out Bulbapedia for greater detail. parameters: - in: path name: id @@ -645,9 +641,9 @@ paths: /api/v2/evolution-chain/: get: operationId: evolution_chain_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Evolution chains are essentially family trees. They start with + the lowest stage within a family and detail evolution conditions for each + as well as Pokémon they can evolve into up through the hierarchy. parameters: - name: limit required: false @@ -677,9 +673,9 @@ paths: /api/v2/evolution-chain/{id}/: get: operationId: evolution_chain_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Evolution chains are essentially family trees. They start with + the lowest stage within a family and detail evolution conditions for each + as well as Pokémon they can evolve into up through the hierarchy. parameters: - in: path name: id @@ -703,9 +699,9 @@ paths: /api/v2/evolution-trigger/: get: operationId: evolution_trigger_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Evolution triggers are the events and conditions that cause a Pokémon + to evolve. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Methods_of_evolution) + for greater detail. parameters: - name: limit required: false @@ -735,9 +731,9 @@ paths: /api/v2/evolution-trigger/{id}/: get: operationId: evolution_trigger_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Evolution triggers are the events and conditions that cause a Pokémon + to evolve. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Methods_of_evolution) + for greater detail. parameters: - in: path name: id @@ -761,9 +757,10 @@ paths: /api/v2/gender/: get: operationId: gender_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Genders were introduced in Generation II for the purposes of breeding + Pokémon but can also result in visual differences or even different evolutionary + lines. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Gender) + for greater detail. parameters: - name: limit required: false @@ -793,9 +790,10 @@ paths: /api/v2/gender/{id}/: get: operationId: gender_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Genders were introduced in Generation II for the purposes of breeding + Pokémon but can also result in visual differences or even different evolutionary + lines. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Gender) + for greater detail. parameters: - in: path name: id @@ -819,9 +817,10 @@ paths: /api/v2/generation/: get: operationId: generation_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: A generation is a grouping of the Pokémon games that separates + them based on the Pokémon they include. In each generation, a new set of Pokémon, + Moves, Abilities and Types that did not exist in the previous generation are + released. parameters: - name: limit required: false @@ -851,9 +850,10 @@ paths: /api/v2/generation/{id}/: get: operationId: generation_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: A generation is a grouping of the Pokémon games that separates + them based on the Pokémon they include. In each generation, a new set of Pokémon, + Moves, Abilities and Types that did not exist in the previous generation are + released. parameters: - in: path name: id @@ -877,9 +877,9 @@ paths: /api/v2/growth-rate/: get: operationId: growth_rate_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Growth rates are the speed with which Pokémon gain levels through + experience. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Experience) + for greater detail. parameters: - name: limit required: false @@ -909,9 +909,9 @@ paths: /api/v2/growth-rate/{id}/: get: operationId: growth_rate_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Growth rates are the speed with which Pokémon gain levels through + experience. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Experience) + for greater detail. parameters: - in: path name: id @@ -935,9 +935,9 @@ paths: /api/v2/item/: get: operationId: item_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: An item is an object in the games which the player can pick up, + keep in their bag, and use in some manner. They have various uses, including + healing, powering up, helping catch Pokémon, or to access a new area. parameters: - name: limit required: false @@ -967,9 +967,8 @@ paths: /api/v2/item-attribute/: get: operationId: item_attribute_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Item attributes define particular aspects of items, e.g."usable + in battle" or "consumable". parameters: - name: limit required: false @@ -999,9 +998,8 @@ paths: /api/v2/item-attribute/{id}/: get: operationId: item_attribute_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Item attributes define particular aspects of items, e.g."usable + in battle" or "consumable". parameters: - in: path name: id @@ -1025,9 +1023,8 @@ paths: /api/v2/item-category/: get: operationId: item_category_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Item categories determine where items will be placed in the players + bag. parameters: - name: limit required: false @@ -1057,9 +1054,8 @@ paths: /api/v2/item-category/{id}/: get: operationId: item_category_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Item categories determine where items will be placed in the players + bag. parameters: - in: path name: id @@ -1083,9 +1079,8 @@ paths: /api/v2/item-fling-effect/: get: operationId: item_fling_effect_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: The various effects of the move"Fling" when used with different + items. parameters: - name: limit required: false @@ -1115,9 +1110,8 @@ paths: /api/v2/item-fling-effect/{id}/: get: operationId: item_fling_effect_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: The various effects of the move"Fling" when used with different + items. parameters: - in: path name: id @@ -1141,9 +1135,7 @@ paths: /api/v2/item-pocket/: get: operationId: item_pocket_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Pockets within the players bag used for storing items by category. parameters: - name: limit required: false @@ -1173,9 +1165,7 @@ paths: /api/v2/item-pocket/{id}/: get: operationId: item_pocket_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Pockets within the players bag used for storing items by category. parameters: - in: path name: id @@ -1199,9 +1189,9 @@ paths: /api/v2/item/{id}/: get: operationId: item_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: An item is an object in the games which the player can pick up, + keep in their bag, and use in some manner. They have various uses, including + healing, powering up, helping catch Pokémon, or to access a new area. parameters: - in: path name: id @@ -1225,9 +1215,7 @@ paths: /api/v2/language/: get: operationId: language_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Languages for translations of API resource information. parameters: - name: limit required: false @@ -1257,9 +1245,7 @@ paths: /api/v2/language/{id}/: get: operationId: language_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Languages for translations of API resource information. parameters: - in: path name: id @@ -1283,9 +1269,8 @@ paths: /api/v2/location/: get: operationId: location_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Locations that can be visited within the games. Locations make + up sizable portions of regions, like cities or routes. parameters: - name: limit required: false @@ -1315,9 +1300,8 @@ paths: /api/v2/location-area/: get: operationId: location_area_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Location areas are sections of areas, such as floors in a building + or cave. Each area has its own set of possible Pokémon encounters. parameters: - name: limit required: false @@ -1347,9 +1331,8 @@ paths: /api/v2/location-area/{id}/: get: operationId: location_area_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Location areas are sections of areas, such as floors in a building + or cave. Each area has its own set of possible Pokémon encounters. parameters: - in: path name: id @@ -1373,9 +1356,8 @@ paths: /api/v2/location/{id}/: get: operationId: location_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Locations that can be visited within the games. Locations make + up sizable portions of regions, like cities or routes. parameters: - in: path name: id @@ -1399,9 +1381,9 @@ paths: /api/v2/machine/: get: operationId: machine_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Machines are the representation of items that teach moves to Pokémon. + They vary from version to version, so it is not certain that one specific + TM or HM corresponds to a single Machine. parameters: - name: limit required: false @@ -1431,9 +1413,9 @@ paths: /api/v2/machine/{id}/: get: operationId: machine_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Machines are the representation of items that teach moves to Pokémon. + They vary from version to version, so it is not certain that one specific + TM or HM corresponds to a single Machine. parameters: - in: path name: id @@ -1457,9 +1439,10 @@ paths: /api/v2/move/: get: operationId: move_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Moves are the skills of Pokémon in battle. In battle, a Pokémon + uses one move each turn. Some moves (including those learned by Hidden Machine) + can be used outside of battle as well, usually for the purpose of removing + obstacles or exploring new areas. parameters: - name: limit required: false @@ -1489,9 +1472,9 @@ paths: /api/v2/move-ailment/: get: operationId: move_ailment_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Move Ailments are status conditions caused by moves used during + battle. See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Status_condition) + for greater detail. parameters: - name: limit required: false @@ -1521,9 +1504,9 @@ paths: /api/v2/move-ailment/{id}/: get: operationId: move_ailment_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Move Ailments are status conditions caused by moves used during + battle. See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Status_condition) + for greater detail. parameters: - in: path name: id @@ -1547,9 +1530,8 @@ paths: /api/v2/move-battle-style/: get: operationId: move_battle_style_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Styles of moves when used in the Battle Palace. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Battle_Frontier_(Generation_III)) + for greater detail. parameters: - name: limit required: false @@ -1579,9 +1561,8 @@ paths: /api/v2/move-battle-style/{id}/: get: operationId: move_battle_style_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Styles of moves when used in the Battle Palace. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Battle_Frontier_(Generation_III)) + for greater detail. parameters: - in: path name: id @@ -1605,9 +1586,7 @@ paths: /api/v2/move-category/: get: operationId: move_category_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Very general categories that loosely group move effects. parameters: - name: limit required: false @@ -1637,9 +1616,7 @@ paths: /api/v2/move-category/{id}/: get: operationId: move_category_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Very general categories that loosely group move effects. parameters: - in: path name: id @@ -1663,9 +1640,7 @@ paths: /api/v2/move-damage-class/: get: operationId: move_damage_class_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Damage classes moves can have, e.g. physical, special, or non-damaging. parameters: - name: limit required: false @@ -1695,9 +1670,7 @@ paths: /api/v2/move-damage-class/{id}/: get: operationId: move_damage_class_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Damage classes moves can have, e.g. physical, special, or non-damaging. parameters: - in: path name: id @@ -1721,9 +1694,7 @@ paths: /api/v2/move-learn-method/: get: operationId: move_learn_method_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Methods by which Pokémon can learn moves. parameters: - name: limit required: false @@ -1753,9 +1724,7 @@ paths: /api/v2/move-learn-method/{id}/: get: operationId: move_learn_method_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Methods by which Pokémon can learn moves. parameters: - in: path name: id @@ -1779,9 +1748,8 @@ paths: /api/v2/move-target/: get: operationId: move_target_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Targets moves can be directed at during battle. Targets can be + Pokémon, environments or even other moves. parameters: - name: limit required: false @@ -1811,9 +1779,8 @@ paths: /api/v2/move-target/{id}/: get: operationId: move_target_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Targets moves can be directed at during battle. Targets can be + Pokémon, environments or even other moves. parameters: - in: path name: id @@ -1837,9 +1804,10 @@ paths: /api/v2/move/{id}/: get: operationId: move_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Moves are the skills of Pokémon in battle. In battle, a Pokémon + uses one move each turn. Some moves (including those learned by Hidden Machine) + can be used outside of battle as well, usually for the purpose of removing + obstacles or exploring new areas. parameters: - in: path name: id @@ -1863,9 +1831,8 @@ paths: /api/v2/nature/: get: operationId: nature_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Natures influence how a Pokémon's stats grow. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Nature) + for greater detail. parameters: - name: limit required: false @@ -1895,9 +1862,8 @@ paths: /api/v2/nature/{id}/: get: operationId: nature_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Natures influence how a Pokémon's stats grow. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Nature) + for greater detail. parameters: - in: path name: id @@ -1921,9 +1887,8 @@ paths: /api/v2/pal-park-area/: get: operationId: pal_park_area_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Areas used for grouping Pokémon encounters in Pal Park. They're + like habitats that are specific to Pal Park. parameters: - name: limit required: false @@ -1953,9 +1918,8 @@ paths: /api/v2/pal-park-area/{id}/: get: operationId: pal_park_area_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Areas used for grouping Pokémon encounters in Pal Park. They're + like habitats that are specific to Pal Park. parameters: - in: path name: id @@ -1979,9 +1943,10 @@ paths: /api/v2/pokeathlon-stat/: get: operationId: pokeathlon_stat_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Pokeathlon Stats are different attributes of a Pokémon's performance + in Pokéathlons. In Pokéathlons, competitions happen on different courses; + one for each of the different Pokéathlon stats. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9athlon) + for greater detail. parameters: - name: limit required: false @@ -2011,9 +1976,10 @@ paths: /api/v2/pokeathlon-stat/{id}/: get: operationId: pokeathlon_stat_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Pokeathlon Stats are different attributes of a Pokémon's performance + in Pokéathlons. In Pokéathlons, competitions happen on different courses; + one for each of the different Pokéathlon stats. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9athlon) + for greater detail. parameters: - in: path name: id @@ -2037,9 +2003,11 @@ paths: /api/v2/pokedex/: get: operationId: pokedex_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: A Pokédex is a handheld electronic encyclopedia device; one which + is capable of recording and retaining information of the various Pokémon in + a given region with the exception of the national dex and some smaller dexes + related to portions of a region. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Pokedex) + for greater detail. parameters: - name: limit required: false @@ -2069,9 +2037,11 @@ paths: /api/v2/pokedex/{id}/: get: operationId: pokedex_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: A Pokédex is a handheld electronic encyclopedia device; one which + is capable of recording and retaining information of the various Pokémon in + a given region with the exception of the national dex and some smaller dexes + related to portions of a region. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Pokedex) + for greater detail. parameters: - in: path name: id @@ -2095,9 +2065,12 @@ paths: /api/v2/pokemon/: get: operationId: pokemon_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Pokémon are the creatures that inhabit the world of the Pokémon + games. They can be caught using Pokéballs and trained by battling with other + Pokémon. Each Pokémon belongs to a specific species but may take on a variant + which makes it differ from other Pokémon of the same species, such as base + stats, available abilities and typings. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9mon_(species)) + for greater detail. parameters: - name: limit required: false @@ -2127,9 +2100,10 @@ paths: /api/v2/pokemon-color/: get: operationId: pokemon_color_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Colors used for sorting Pokémon in a Pokédex. The color listed + in the Pokédex is usually the color most apparent or covering each Pokémon's + body. No orange category exists; Pokémon that are primarily orange are listed + as red or brown. parameters: - name: limit required: false @@ -2159,9 +2133,10 @@ paths: /api/v2/pokemon-color/{id}/: get: operationId: pokemon_color_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Colors used for sorting Pokémon in a Pokédex. The color listed + in the Pokédex is usually the color most apparent or covering each Pokémon's + body. No orange category exists; Pokémon that are primarily orange are listed + as red or brown. parameters: - in: path name: id @@ -2185,9 +2160,10 @@ paths: /api/v2/pokemon-form/: get: operationId: pokemon_form_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Some Pokémon may appear in one of multiple, visually different + forms. These differences are purely cosmetic. For variations within a Pokémon + species, which do differ in more than just visuals, the 'Pokémon' entity is + used to represent such a variety. parameters: - name: limit required: false @@ -2217,9 +2193,10 @@ paths: /api/v2/pokemon-form/{id}/: get: operationId: pokemon_form_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Some Pokémon may appear in one of multiple, visually different + forms. These differences are purely cosmetic. For variations within a Pokémon + species, which do differ in more than just visuals, the 'Pokémon' entity is + used to represent such a variety. parameters: - in: path name: id @@ -2243,9 +2220,8 @@ paths: /api/v2/pokemon-habitat/: get: operationId: pokemon_habitat_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Habitats are generally different terrain Pokémon can be found in + but can also be areas designated for rare or legendary Pokémon. parameters: - name: limit required: false @@ -2275,9 +2251,8 @@ paths: /api/v2/pokemon-habitat/{id}/: get: operationId: pokemon_habitat_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Habitats are generally different terrain Pokémon can be found in + but can also be areas designated for rare or legendary Pokémon. parameters: - in: path name: id @@ -2301,9 +2276,7 @@ paths: /api/v2/pokemon-shape/: get: operationId: pokemon_shape_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Shapes used for sorting Pokémon in a Pokédex. parameters: - name: limit required: false @@ -2333,9 +2306,7 @@ paths: /api/v2/pokemon-shape/{id}/: get: operationId: pokemon_shape_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Shapes used for sorting Pokémon in a Pokédex. parameters: - in: path name: id @@ -2359,9 +2330,10 @@ paths: /api/v2/pokemon-species/: get: operationId: pokemon_species_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: A Pokémon Species forms the basis for at least one Pokémon. Attributes + of a Pokémon species are shared across all varieties of Pokémon within the + species. A good example is Wormadam; Wormadam is the species which can be + found in three different varieties, Wormadam-Trash, Wormadam-Sandy and Wormadam-Plant. parameters: - name: limit required: false @@ -2391,9 +2363,10 @@ paths: /api/v2/pokemon-species/{id}/: get: operationId: pokemon_species_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: A Pokémon Species forms the basis for at least one Pokémon. Attributes + of a Pokémon species are shared across all varieties of Pokémon within the + species. A good example is Wormadam; Wormadam is the species which can be + found in three different varieties, Wormadam-Trash, Wormadam-Sandy and Wormadam-Plant. parameters: - in: path name: id @@ -2417,9 +2390,12 @@ paths: /api/v2/pokemon/{id}/: get: operationId: pokemon_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Pokémon are the creatures that inhabit the world of the Pokémon + games. They can be caught using Pokéballs and trained by battling with other + Pokémon. Each Pokémon belongs to a specific species but may take on a variant + which makes it differ from other Pokémon of the same species, such as base + stats, available abilities and typings. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9mon_(species)) + for greater detail. parameters: - in: path name: id @@ -2463,9 +2439,9 @@ paths: /api/v2/region/: get: operationId: region_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: A region is an organized area of the Pokémon world. Most often, + the main difference between regions is the species of Pokémon that can be + encountered within them. parameters: - name: limit required: false @@ -2495,9 +2471,9 @@ paths: /api/v2/region/{id}/: get: operationId: region_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: A region is an organized area of the Pokémon world. Most often, + the main difference between regions is the species of Pokémon that can be + encountered within them. parameters: - in: path name: id @@ -2521,9 +2497,9 @@ paths: /api/v2/stat/: get: operationId: stat_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Stats determine certain aspects of battles. Each Pokémon has a + value for each stat which grows as they gain levels and can be altered momentarily + by effects in battles. parameters: - name: limit required: false @@ -2553,9 +2529,9 @@ paths: /api/v2/stat/{id}/: get: operationId: stat_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Stats determine certain aspects of battles. Each Pokémon has a + value for each stat which grows as they gain levels and can be altered momentarily + by effects in battles. parameters: - in: path name: id @@ -2579,9 +2555,8 @@ paths: /api/v2/super-contest-effect/: get: operationId: super_contest_effect_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Super contest effects refer to the effects of moves when used in + super contests. parameters: - name: limit required: false @@ -2611,9 +2586,8 @@ paths: /api/v2/super-contest-effect/{id}/: get: operationId: super_contest_effect_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Super contest effects refer to the effects of moves when used in + super contests. parameters: - in: path name: id @@ -2637,9 +2611,10 @@ paths: /api/v2/type/: get: operationId: type_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: 'Types are properties for Pokémon and their moves. Each type has + three properties: which types of Pokémon it is super effective against, which + types of Pokémon it is not very effective against, and which types of Pokémon + it is completely ineffective against.' parameters: - name: limit required: false @@ -2669,9 +2644,10 @@ paths: /api/v2/type/{id}/: get: operationId: type_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: 'Types are properties for Pokémon and their moves. Each type has + three properties: which types of Pokémon it is super effective against, which + types of Pokémon it is not very effective against, and which types of Pokémon + it is completely ineffective against.' parameters: - in: path name: id @@ -2695,9 +2671,7 @@ paths: /api/v2/version/: get: operationId: version_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Versions of the games, e.g., Red, Blue or Yellow. parameters: - name: limit required: false @@ -2727,9 +2701,7 @@ paths: /api/v2/version-group/: get: operationId: version_group_list - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Version groups categorize highly similar versions of the games. parameters: - name: limit required: false @@ -2759,9 +2731,7 @@ paths: /api/v2/version-group/{id}/: get: operationId: version_group_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Version groups categorize highly similar versions of the games. parameters: - in: path name: id @@ -2785,9 +2755,7 @@ paths: /api/v2/version/{id}/: get: operationId: version_retrieve - description: |- - Mixin to allow association with separate serializers - for list or detail view. + description: Versions of the games, e.g., Red, Blue or Yellow. parameters: - in: path name: id From 5e1c02b07ab9cc9f38f224ec8a1c307869a83719 Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Mon, 26 Feb 2024 02:10:24 -0600 Subject: [PATCH 15/49] docs(openapi): add tags (groups) --- openapi.yml | 186 +++++++++++++++++------------------ pokemon_v2/api.py | 245 ++++++++++++++++++++++++++++++++++++---------- 2 files changed, 289 insertions(+), 142 deletions(-) diff --git a/openapi.yml b/openapi.yml index 69910fdaf..34c3c277a 100644 --- a/openapi.yml +++ b/openapi.yml @@ -25,7 +25,7 @@ paths: schema: type: integer tags: - - ability + - pokemon security: - cookieAuth: [] - basicAuth: [] @@ -52,7 +52,7 @@ paths: description: A unique integer value identifying this ability. required: true tags: - - ability + - pokemon security: - cookieAuth: [] - basicAuth: [] @@ -85,7 +85,7 @@ paths: schema: type: integer tags: - - berry + - berries security: - cookieAuth: [] - basicAuth: [] @@ -116,7 +116,7 @@ paths: schema: type: integer tags: - - berry-firmness + - berries security: - cookieAuth: [] - basicAuth: [] @@ -141,7 +141,7 @@ paths: description: A unique integer value identifying this berry firmness. required: true tags: - - berry-firmness + - berries security: - cookieAuth: [] - basicAuth: [] @@ -173,7 +173,7 @@ paths: schema: type: integer tags: - - berry-flavor + - berries security: - cookieAuth: [] - basicAuth: [] @@ -199,7 +199,7 @@ paths: description: A unique integer value identifying this berry flavor. required: true tags: - - berry-flavor + - berries security: - cookieAuth: [] - basicAuth: [] @@ -226,7 +226,7 @@ paths: description: A unique integer value identifying this berry. required: true tags: - - berry + - berries security: - cookieAuth: [] - basicAuth: [] @@ -259,7 +259,7 @@ paths: schema: type: integer tags: - - characteristic + - pokemon security: - cookieAuth: [] - basicAuth: [] @@ -286,7 +286,7 @@ paths: description: A unique integer value identifying this characteristic. required: true tags: - - characteristic + - pokemon security: - cookieAuth: [] - basicAuth: [] @@ -316,7 +316,7 @@ paths: schema: type: integer tags: - - contest-effect + - contests security: - cookieAuth: [] - basicAuth: [] @@ -340,7 +340,7 @@ paths: description: A unique integer value identifying this contest effect. required: true tags: - - contest-effect + - contests security: - cookieAuth: [] - basicAuth: [] @@ -372,7 +372,7 @@ paths: schema: type: integer tags: - - contest-type + - contests security: - cookieAuth: [] - basicAuth: [] @@ -398,7 +398,7 @@ paths: description: A unique integer value identifying this contest type. required: true tags: - - contest-type + - contests security: - cookieAuth: [] - basicAuth: [] @@ -431,7 +431,7 @@ paths: schema: type: integer tags: - - egg-group + - pokemon security: - cookieAuth: [] - basicAuth: [] @@ -458,7 +458,7 @@ paths: description: A unique integer value identifying this egg group. required: true tags: - - egg-group + - pokemon security: - cookieAuth: [] - basicAuth: [] @@ -489,7 +489,7 @@ paths: schema: type: integer tags: - - encounter-condition + - encounters security: - cookieAuth: [] - basicAuth: [] @@ -520,7 +520,7 @@ paths: schema: type: integer tags: - - encounter-condition-value + - encounters security: - cookieAuth: [] - basicAuth: [] @@ -545,7 +545,7 @@ paths: description: A unique integer value identifying this encounter condition value. required: true tags: - - encounter-condition-value + - encounters security: - cookieAuth: [] - basicAuth: [] @@ -570,7 +570,7 @@ paths: description: A unique integer value identifying this encounter condition. required: true tags: - - encounter-condition + - encounters security: - cookieAuth: [] - basicAuth: [] @@ -601,7 +601,7 @@ paths: schema: type: integer tags: - - encounter-method + - encounters security: - cookieAuth: [] - basicAuth: [] @@ -626,7 +626,7 @@ paths: description: A unique integer value identifying this encounter method. required: true tags: - - encounter-method + - encounters security: - cookieAuth: [] - basicAuth: [] @@ -658,7 +658,7 @@ paths: schema: type: integer tags: - - evolution-chain + - evolution security: - cookieAuth: [] - basicAuth: [] @@ -684,7 +684,7 @@ paths: description: A unique integer value identifying this evolution chain. required: true tags: - - evolution-chain + - evolution security: - cookieAuth: [] - basicAuth: [] @@ -716,7 +716,7 @@ paths: schema: type: integer tags: - - evolution-trigger + - evolution security: - cookieAuth: [] - basicAuth: [] @@ -742,7 +742,7 @@ paths: description: A unique integer value identifying this evolution trigger. required: true tags: - - evolution-trigger + - evolution security: - cookieAuth: [] - basicAuth: [] @@ -775,7 +775,7 @@ paths: schema: type: integer tags: - - gender + - pokemon security: - cookieAuth: [] - basicAuth: [] @@ -802,7 +802,7 @@ paths: description: A unique integer value identifying this gender. required: true tags: - - gender + - pokemon security: - cookieAuth: [] - basicAuth: [] @@ -835,7 +835,7 @@ paths: schema: type: integer tags: - - generation + - games security: - cookieAuth: [] - basicAuth: [] @@ -862,7 +862,7 @@ paths: description: A unique integer value identifying this generation. required: true tags: - - generation + - games security: - cookieAuth: [] - basicAuth: [] @@ -894,7 +894,7 @@ paths: schema: type: integer tags: - - growth-rate + - pokemon security: - cookieAuth: [] - basicAuth: [] @@ -920,7 +920,7 @@ paths: description: A unique integer value identifying this growth rate. required: true tags: - - growth-rate + - pokemon security: - cookieAuth: [] - basicAuth: [] @@ -952,7 +952,7 @@ paths: schema: type: integer tags: - - item + - items security: - cookieAuth: [] - basicAuth: [] @@ -983,7 +983,7 @@ paths: schema: type: integer tags: - - item-attribute + - items security: - cookieAuth: [] - basicAuth: [] @@ -1008,7 +1008,7 @@ paths: description: A unique integer value identifying this item attribute. required: true tags: - - item-attribute + - items security: - cookieAuth: [] - basicAuth: [] @@ -1039,7 +1039,7 @@ paths: schema: type: integer tags: - - item-category + - items security: - cookieAuth: [] - basicAuth: [] @@ -1064,7 +1064,7 @@ paths: description: A unique integer value identifying this item category. required: true tags: - - item-category + - items security: - cookieAuth: [] - basicAuth: [] @@ -1095,7 +1095,7 @@ paths: schema: type: integer tags: - - item-fling-effect + - items security: - cookieAuth: [] - basicAuth: [] @@ -1120,7 +1120,7 @@ paths: description: A unique integer value identifying this item fling effect. required: true tags: - - item-fling-effect + - items security: - cookieAuth: [] - basicAuth: [] @@ -1150,7 +1150,7 @@ paths: schema: type: integer tags: - - item-pocket + - items security: - cookieAuth: [] - basicAuth: [] @@ -1174,7 +1174,7 @@ paths: description: A unique integer value identifying this item pocket. required: true tags: - - item-pocket + - items security: - cookieAuth: [] - basicAuth: [] @@ -1200,7 +1200,7 @@ paths: description: A unique integer value identifying this item. required: true tags: - - item + - items security: - cookieAuth: [] - basicAuth: [] @@ -1230,7 +1230,7 @@ paths: schema: type: integer tags: - - language + - utility security: - cookieAuth: [] - basicAuth: [] @@ -1254,7 +1254,7 @@ paths: description: A unique integer value identifying this language. required: true tags: - - language + - utility security: - cookieAuth: [] - basicAuth: [] @@ -1316,7 +1316,7 @@ paths: schema: type: integer tags: - - location-area + - location security: - cookieAuth: [] - basicAuth: [] @@ -1341,7 +1341,7 @@ paths: description: A unique integer value identifying this location area. required: true tags: - - location-area + - location security: - cookieAuth: [] - basicAuth: [] @@ -1398,7 +1398,7 @@ paths: schema: type: integer tags: - - machine + - machines security: - cookieAuth: [] - basicAuth: [] @@ -1424,7 +1424,7 @@ paths: description: A unique integer value identifying this machine. required: true tags: - - machine + - machines security: - cookieAuth: [] - basicAuth: [] @@ -1457,7 +1457,7 @@ paths: schema: type: integer tags: - - move + - moves security: - cookieAuth: [] - basicAuth: [] @@ -1489,7 +1489,7 @@ paths: schema: type: integer tags: - - move-ailment + - moves security: - cookieAuth: [] - basicAuth: [] @@ -1515,7 +1515,7 @@ paths: description: A unique integer value identifying this move meta ailment. required: true tags: - - move-ailment + - moves security: - cookieAuth: [] - basicAuth: [] @@ -1546,7 +1546,7 @@ paths: schema: type: integer tags: - - move-battle-style + - moves security: - cookieAuth: [] - basicAuth: [] @@ -1571,7 +1571,7 @@ paths: description: A unique integer value identifying this move battle style. required: true tags: - - move-battle-style + - moves security: - cookieAuth: [] - basicAuth: [] @@ -1601,7 +1601,7 @@ paths: schema: type: integer tags: - - move-category + - moves security: - cookieAuth: [] - basicAuth: [] @@ -1625,7 +1625,7 @@ paths: description: A unique integer value identifying this move meta category. required: true tags: - - move-category + - moves security: - cookieAuth: [] - basicAuth: [] @@ -1655,7 +1655,7 @@ paths: schema: type: integer tags: - - move-damage-class + - pokemon security: - cookieAuth: [] - basicAuth: [] @@ -1679,7 +1679,7 @@ paths: description: A unique integer value identifying this move damage class. required: true tags: - - move-damage-class + - pokemon security: - cookieAuth: [] - basicAuth: [] @@ -1709,7 +1709,7 @@ paths: schema: type: integer tags: - - move-learn-method + - moves security: - cookieAuth: [] - basicAuth: [] @@ -1733,7 +1733,7 @@ paths: description: A unique integer value identifying this move learn method. required: true tags: - - move-learn-method + - moves security: - cookieAuth: [] - basicAuth: [] @@ -1764,7 +1764,7 @@ paths: schema: type: integer tags: - - move-target + - moves security: - cookieAuth: [] - basicAuth: [] @@ -1789,7 +1789,7 @@ paths: description: A unique integer value identifying this move target. required: true tags: - - move-target + - moves security: - cookieAuth: [] - basicAuth: [] @@ -1816,7 +1816,7 @@ paths: description: A unique integer value identifying this move. required: true tags: - - move + - moves security: - cookieAuth: [] - basicAuth: [] @@ -1847,7 +1847,7 @@ paths: schema: type: integer tags: - - nature + - pokemon security: - cookieAuth: [] - basicAuth: [] @@ -1872,7 +1872,7 @@ paths: description: A unique integer value identifying this nature. required: true tags: - - nature + - pokemon security: - cookieAuth: [] - basicAuth: [] @@ -1903,7 +1903,7 @@ paths: schema: type: integer tags: - - pal-park-area + - location security: - cookieAuth: [] - basicAuth: [] @@ -1928,7 +1928,7 @@ paths: description: A unique integer value identifying this pal park area. required: true tags: - - pal-park-area + - location security: - cookieAuth: [] - basicAuth: [] @@ -1961,7 +1961,7 @@ paths: schema: type: integer tags: - - pokeathlon-stat + - pokemon security: - cookieAuth: [] - basicAuth: [] @@ -1988,7 +1988,7 @@ paths: description: A unique integer value identifying this pokeathlon stat. required: true tags: - - pokeathlon-stat + - pokemon security: - cookieAuth: [] - basicAuth: [] @@ -2022,7 +2022,7 @@ paths: schema: type: integer tags: - - pokedex + - games security: - cookieAuth: [] - basicAuth: [] @@ -2050,7 +2050,7 @@ paths: description: A unique integer value identifying this pokedex. required: true tags: - - pokedex + - games security: - cookieAuth: [] - basicAuth: [] @@ -2118,7 +2118,7 @@ paths: schema: type: integer tags: - - pokemon-color + - pokemon security: - cookieAuth: [] - basicAuth: [] @@ -2145,7 +2145,7 @@ paths: description: A unique integer value identifying this pokemon color. required: true tags: - - pokemon-color + - pokemon security: - cookieAuth: [] - basicAuth: [] @@ -2178,7 +2178,7 @@ paths: schema: type: integer tags: - - pokemon-form + - pokemon security: - cookieAuth: [] - basicAuth: [] @@ -2205,7 +2205,7 @@ paths: description: A unique integer value identifying this pokemon form. required: true tags: - - pokemon-form + - pokemon security: - cookieAuth: [] - basicAuth: [] @@ -2236,7 +2236,7 @@ paths: schema: type: integer tags: - - pokemon-habitat + - pokemon security: - cookieAuth: [] - basicAuth: [] @@ -2261,7 +2261,7 @@ paths: description: A unique integer value identifying this pokemon habitat. required: true tags: - - pokemon-habitat + - pokemon security: - cookieAuth: [] - basicAuth: [] @@ -2291,7 +2291,7 @@ paths: schema: type: integer tags: - - pokemon-shape + - pokemon security: - cookieAuth: [] - basicAuth: [] @@ -2315,7 +2315,7 @@ paths: description: A unique integer value identifying this pokemon shape. required: true tags: - - pokemon-shape + - pokemon security: - cookieAuth: [] - basicAuth: [] @@ -2348,7 +2348,7 @@ paths: schema: type: integer tags: - - pokemon-species + - pokemon security: - cookieAuth: [] - basicAuth: [] @@ -2375,7 +2375,7 @@ paths: description: A unique integer value identifying this pokemon species. required: true tags: - - pokemon-species + - pokemon security: - cookieAuth: [] - basicAuth: [] @@ -2428,7 +2428,7 @@ paths: pattern: ^\d+$ required: true tags: - - pokemon + - encounters security: - cookieAuth: [] - basicAuth: [] @@ -2456,7 +2456,7 @@ paths: schema: type: integer tags: - - region + - location security: - cookieAuth: [] - basicAuth: [] @@ -2482,7 +2482,7 @@ paths: description: A unique integer value identifying this region. required: true tags: - - region + - location security: - cookieAuth: [] - basicAuth: [] @@ -2514,7 +2514,7 @@ paths: schema: type: integer tags: - - stat + - pokemon security: - cookieAuth: [] - basicAuth: [] @@ -2540,7 +2540,7 @@ paths: description: A unique integer value identifying this stat. required: true tags: - - stat + - pokemon security: - cookieAuth: [] - basicAuth: [] @@ -2571,7 +2571,7 @@ paths: schema: type: integer tags: - - super-contest-effect + - contests security: - cookieAuth: [] - basicAuth: [] @@ -2596,7 +2596,7 @@ paths: description: A unique integer value identifying this super contest effect. required: true tags: - - super-contest-effect + - contests security: - cookieAuth: [] - basicAuth: [] @@ -2629,7 +2629,7 @@ paths: schema: type: integer tags: - - type + - pokemon security: - cookieAuth: [] - basicAuth: [] @@ -2656,7 +2656,7 @@ paths: description: A unique integer value identifying this type. required: true tags: - - type + - pokemon security: - cookieAuth: [] - basicAuth: [] @@ -2686,7 +2686,7 @@ paths: schema: type: integer tags: - - version + - games security: - cookieAuth: [] - basicAuth: [] @@ -2716,7 +2716,7 @@ paths: schema: type: integer tags: - - version-group + - games security: - cookieAuth: [] - basicAuth: [] @@ -2740,7 +2740,7 @@ paths: description: A unique integer value identifying this version group. required: true tags: - - version-group + - games security: - cookieAuth: [] - basicAuth: [] @@ -2764,7 +2764,7 @@ paths: description: A unique integer value identifying this version. required: true tags: - - version + - games security: - cookieAuth: [] - basicAuth: [] diff --git a/pokemon_v2/api.py b/pokemon_v2/api.py index c2f443863..8dcd1c1fe 100644 --- a/pokemon_v2/api.py +++ b/pokemon_v2/api.py @@ -71,343 +71,490 @@ class PokeapiCommonViewset( ########## -@extend_schema(description='Abilities provide passive effects for Pokémon in battle or in the overworld. Pokémon have multiple possible abilities but can have only one ability at a time. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Ability) for greater detail.') +@extend_schema( + description='Abilities provide passive effects for Pokémon in battle or in the overworld. Pokémon have multiple possible abilities but can have only one ability at a time. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Ability) for greater detail.', + tags=[ 'pokemon' ] + ) class AbilityResource(PokeapiCommonViewset): queryset = Ability.objects.all() serializer_class = AbilityDetailSerializer list_serializer_class = AbilitySummarySerializer -@extend_schema(description='Berries are small fruits that can provide HP and status condition restoration, stat enhancement, and even damage negation when eaten by Pokémon. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Berry) for greater detail.') +@extend_schema( + description='Berries are small fruits that can provide HP and status condition restoration, stat enhancement, and even damage negation when eaten by Pokémon. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Berry) for greater detail.', + tags=[ 'berries' ] + ) class BerryResource(PokeapiCommonViewset): queryset = Berry.objects.all() serializer_class = BerryDetailSerializer list_serializer_class = BerrySummarySerializer -@extend_schema(description='Berries can be soft or hard. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Category:Berries_by_firmness) for greater detail.') +@extend_schema( + description='Berries can be soft or hard. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Category:Berries_by_firmness) for greater detail.', + tags=[ 'berries' ] + ) class BerryFirmnessResource(PokeapiCommonViewset): queryset = BerryFirmness.objects.all() serializer_class = BerryFirmnessDetailSerializer list_serializer_class = BerryFirmnessSummarySerializer -@extend_schema(description='Flavors determine whether a Pokémon will benefit or suffer from eating a berry based on their **nature**. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Flavor) for greater detail.') +@extend_schema( + description='Flavors determine whether a Pokémon will benefit or suffer from eating a berry based on their **nature**. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Flavor) for greater detail.', + tags=[ 'berries' ] + ) class BerryFlavorResource(PokeapiCommonViewset): queryset = BerryFlavor.objects.all() serializer_class = BerryFlavorDetailSerializer list_serializer_class = BerryFlavorSummarySerializer -@extend_schema(description='Characteristics indicate which stat contains a Pokémon\'s highest IV. A Pokémon\'s Characteristic is determined by the remainder of its highest IV divided by 5 (gene_modulo). Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Characteristic) for greater detail.') +@extend_schema( + description='Characteristics indicate which stat contains a Pokémon\'s highest IV. A Pokémon\'s Characteristic is determined by the remainder of its highest IV divided by 5 (gene_modulo). Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Characteristic) for greater detail.', + tags=[ 'pokemon' ] + ) class CharacteristicResource(PokeapiCommonViewset): queryset = Characteristic.objects.all() serializer_class = CharacteristicDetailSerializer list_serializer_class = CharacteristicSummarySerializer -@extend_schema(description='Contest effects refer to the effects of moves when used in contests.') +@extend_schema( + description='Contest effects refer to the effects of moves when used in contests.', + tags=[ 'contests' ] + ) class ContestEffectResource(PokeapiCommonViewset): queryset = ContestEffect.objects.all() serializer_class = ContestEffectDetailSerializer list_serializer_class = ContestEffectSummarySerializer -@extend_schema(description='Contest types are categories judges used to weigh a Pokémon\'s condition in Pokémon contests. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Contest_condition) for greater detail.') +@extend_schema( + description='Contest types are categories judges used to weigh a Pokémon\'s condition in Pokémon contests. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Contest_condition) for greater detail.', + tags=[ 'contests' ] + ) class ContestTypeResource(PokeapiCommonViewset): queryset = ContestType.objects.all() serializer_class = ContestTypeDetailSerializer list_serializer_class = ContestTypeSummarySerializer -@extend_schema(description='Egg Groups are categories which determine which Pokémon are able to interbreed. Pokémon may belong to either one or two Egg Groups. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Egg_Group) for greater detail.') +@extend_schema( + description='Egg Groups are categories which determine which Pokémon are able to interbreed. Pokémon may belong to either one or two Egg Groups. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Egg_Group) for greater detail.', + tags=[ 'pokemon' ] + ) class EggGroupResource(PokeapiCommonViewset): queryset = EggGroup.objects.all() serializer_class = EggGroupDetailSerializer list_serializer_class = EggGroupSummarySerializer -@extend_schema(description='Conditions which affect what pokemon might appear in the wild, e.g., day or night.') +@extend_schema( + description='Conditions which affect what pokemon might appear in the wild, e.g., day or night.', + tags=[ 'encounters' ] + ) class EncounterConditionResource(PokeapiCommonViewset): queryset = EncounterCondition.objects.all() serializer_class = EncounterConditionDetailSerializer list_serializer_class = EncounterConditionSummarySerializer -@extend_schema(description='Encounter condition values are the various states that an encounter condition can have, i.e., time of day can be either day or night.') +@extend_schema( + description='Encounter condition values are the various states that an encounter condition can have, i.e., time of day can be either day or night.', + tags=[ 'encounters' ] + ) class EncounterConditionValueResource(PokeapiCommonViewset): queryset = EncounterConditionValue.objects.all() serializer_class = EncounterConditionValueDetailSerializer list_serializer_class = EncounterConditionValueSummarySerializer -@extend_schema(description='Methods by which the player might can encounter Pokémon in the wild, e.g., walking in tall grass. Check out Bulbapedia for greater detail.') +@extend_schema( + description='Methods by which the player might can encounter Pokémon in the wild, e.g., walking in tall grass. Check out Bulbapedia for greater detail.', + tags=[ 'encounters' ] + ) class EncounterMethodResource(PokeapiCommonViewset): queryset = EncounterMethod.objects.all() serializer_class = EncounterMethodDetailSerializer list_serializer_class = EncounterMethodSummarySerializer -@extend_schema(description='Evolution chains are essentially family trees. They start with the lowest stage within a family and detail evolution conditions for each as well as Pokémon they can evolve into up through the hierarchy.') +@extend_schema( + description='Evolution chains are essentially family trees. They start with the lowest stage within a family and detail evolution conditions for each as well as Pokémon they can evolve into up through the hierarchy.', + tags=[ 'evolution' ] + ) class EvolutionChainResource(PokeapiCommonViewset): queryset = EvolutionChain.objects.all() serializer_class = EvolutionChainDetailSerializer list_serializer_class = EvolutionChainSummarySerializer -@extend_schema(description='Evolution triggers are the events and conditions that cause a Pokémon to evolve. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Methods_of_evolution) for greater detail.') +@extend_schema( + description='Evolution triggers are the events and conditions that cause a Pokémon to evolve. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Methods_of_evolution) for greater detail.', + tags=[ 'evolution' ] + ) class EvolutionTriggerResource(PokeapiCommonViewset): queryset = EvolutionTrigger.objects.all() serializer_class = EvolutionTriggerDetailSerializer list_serializer_class = EvolutionTriggerSummarySerializer -@extend_schema(description='A generation is a grouping of the Pokémon games that separates them based on the Pokémon they include. In each generation, a new set of Pokémon, Moves, Abilities and Types that did not exist in the previous generation are released.') +@extend_schema( + description='A generation is a grouping of the Pokémon games that separates them based on the Pokémon they include. In each generation, a new set of Pokémon, Moves, Abilities and Types that did not exist in the previous generation are released.', + tags=[ 'games' ] + ) class GenerationResource(PokeapiCommonViewset): queryset = Generation.objects.all() serializer_class = GenerationDetailSerializer list_serializer_class = GenerationSummarySerializer -@extend_schema(description='Genders were introduced in Generation II for the purposes of breeding Pokémon but can also result in visual differences or even different evolutionary lines. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Gender) for greater detail.') +@extend_schema( + description='Genders were introduced in Generation II for the purposes of breeding Pokémon but can also result in visual differences or even different evolutionary lines. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Gender) for greater detail.', + tags=[ 'pokemon' ] + ) class GenderResource(PokeapiCommonViewset): queryset = Gender.objects.all() serializer_class = GenderDetailSerializer list_serializer_class = GenderSummarySerializer -@extend_schema(description='Growth rates are the speed with which Pokémon gain levels through experience. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Experience) for greater detail.') +@extend_schema( + description='Growth rates are the speed with which Pokémon gain levels through experience. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Experience) for greater detail.', + tags=[ 'pokemon' ] + ) class GrowthRateResource(PokeapiCommonViewset): queryset = GrowthRate.objects.all() serializer_class = GrowthRateDetailSerializer list_serializer_class = GrowthRateSummarySerializer -@extend_schema(description='An item is an object in the games which the player can pick up, keep in their bag, and use in some manner. They have various uses, including healing, powering up, helping catch Pokémon, or to access a new area.') +@extend_schema( + description='An item is an object in the games which the player can pick up, keep in their bag, and use in some manner. They have various uses, including healing, powering up, helping catch Pokémon, or to access a new area.', + tags=[ 'items' ] + ) class ItemResource(PokeapiCommonViewset): queryset = Item.objects.all() serializer_class = ItemDetailSerializer list_serializer_class = ItemSummarySerializer -@extend_schema(description='Item categories determine where items will be placed in the players bag.') +@extend_schema( + description='Item categories determine where items will be placed in the players bag.', + tags=[ 'items' ] + ) class ItemCategoryResource(PokeapiCommonViewset): queryset = ItemCategory.objects.all() serializer_class = ItemCategoryDetailSerializer list_serializer_class = ItemCategorySummarySerializer -@extend_schema(description='Item attributes define particular aspects of items, e.g."usable in battle" or "consumable".') +@extend_schema( + description='Item attributes define particular aspects of items, e.g."usable in battle" or "consumable".', + tags=[ 'items' ] + ) class ItemAttributeResource(PokeapiCommonViewset): queryset = ItemAttribute.objects.all() serializer_class = ItemAttributeDetailSerializer list_serializer_class = ItemAttributeSummarySerializer -@extend_schema(description='The various effects of the move"Fling" when used with different items.') +@extend_schema( + description='The various effects of the move"Fling" when used with different items.', + tags=[ 'items' ] + ) class ItemFlingEffectResource(PokeapiCommonViewset): queryset = ItemFlingEffect.objects.all() serializer_class = ItemFlingEffectDetailSerializer list_serializer_class = ItemFlingEffectSummarySerializer -@extend_schema(description='Pockets within the players bag used for storing items by category.') +@extend_schema( + description='Pockets within the players bag used for storing items by category.', + tags=[ 'items' ] + ) class ItemPocketResource(PokeapiCommonViewset): queryset = ItemPocket.objects.all() serializer_class = ItemPocketDetailSerializer list_serializer_class = ItemPocketSummarySerializer -@extend_schema(description='Languages for translations of API resource information.') +@extend_schema( + description='Languages for translations of API resource information.', + tags=[ 'utility' ] + ) class LanguageResource(PokeapiCommonViewset): queryset = Language.objects.all() serializer_class = LanguageDetailSerializer list_serializer_class = LanguageSummarySerializer -@extend_schema(description='Locations that can be visited within the games. Locations make up sizable portions of regions, like cities or routes.') +@extend_schema( + description='Locations that can be visited within the games. Locations make up sizable portions of regions, like cities or routes.', + tags=[ 'location' ] + ) class LocationResource(PokeapiCommonViewset): queryset = Location.objects.all() serializer_class = LocationDetailSerializer list_serializer_class = LocationSummarySerializer -@extend_schema(description='Location areas are sections of areas, such as floors in a building or cave. Each area has its own set of possible Pokémon encounters.') +@extend_schema( + description='Location areas are sections of areas, such as floors in a building or cave. Each area has its own set of possible Pokémon encounters.', + tags=[ 'location' ] + ) class LocationAreaResource(ListOrDetailSerialRelation, viewsets.ReadOnlyModelViewSet): queryset = LocationArea.objects.all() serializer_class = LocationAreaDetailSerializer list_serializer_class = LocationAreaSummarySerializer -@extend_schema(description='Machines are the representation of items that teach moves to Pokémon. They vary from version to version, so it is not certain that one specific TM or HM corresponds to a single Machine.') +@extend_schema( + description='Machines are the representation of items that teach moves to Pokémon. They vary from version to version, so it is not certain that one specific TM or HM corresponds to a single Machine.', + tags=[ 'machines' ] + ) class MachineResource(PokeapiCommonViewset): queryset = Machine.objects.all() serializer_class = MachineDetailSerializer list_serializer_class = MachineSummarySerializer -@extend_schema(description='Moves are the skills of Pokémon in battle. In battle, a Pokémon uses one move each turn. Some moves (including those learned by Hidden Machine) can be used outside of battle as well, usually for the purpose of removing obstacles or exploring new areas.') +@extend_schema( + description='Moves are the skills of Pokémon in battle. In battle, a Pokémon uses one move each turn. Some moves (including those learned by Hidden Machine) can be used outside of battle as well, usually for the purpose of removing obstacles or exploring new areas.', + tags=[ 'moves' ] + ) class MoveResource(PokeapiCommonViewset): queryset = Move.objects.all() serializer_class = MoveDetailSerializer list_serializer_class = MoveSummarySerializer -@extend_schema(description='Damage classes moves can have, e.g. physical, special, or non-damaging.') +@extend_schema( + description='Damage classes moves can have, e.g. physical, special, or non-damaging.', + tags=[ 'pokemon' ] + ) class MoveDamageClassResource(PokeapiCommonViewset): queryset = MoveDamageClass.objects.all() serializer_class = MoveDamageClassDetailSerializer list_serializer_class = MoveDamageClassSummarySerializer -@extend_schema(description='Move Ailments are status conditions caused by moves used during battle. See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Status_condition) for greater detail.') +@extend_schema( + description='Move Ailments are status conditions caused by moves used during battle. See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Status_condition) for greater detail.', + tags=[ 'moves' ] + ) class MoveMetaAilmentResource(PokeapiCommonViewset): queryset = MoveMetaAilment.objects.all() serializer_class = MoveMetaAilmentDetailSerializer list_serializer_class = MoveMetaAilmentSummarySerializer -@extend_schema(description='Styles of moves when used in the Battle Palace. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Battle_Frontier_(Generation_III)) for greater detail.') +@extend_schema( + description='Styles of moves when used in the Battle Palace. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Battle_Frontier_(Generation_III)) for greater detail.', + tags=[ 'moves' ] + ) class MoveBattleStyleResource(PokeapiCommonViewset): queryset = MoveBattleStyle.objects.all() serializer_class = MoveBattleStyleDetailSerializer list_serializer_class = MoveBattleStyleSummarySerializer -@extend_schema(description='Very general categories that loosely group move effects.') +@extend_schema( + description='Very general categories that loosely group move effects.', + tags=[ 'moves' ] + ) class MoveMetaCategoryResource(PokeapiCommonViewset): queryset = MoveMetaCategory.objects.all() serializer_class = MoveMetaCategoryDetailSerializer list_serializer_class = MoveMetaCategorySummarySerializer -@extend_schema(description='Methods by which Pokémon can learn moves.') +@extend_schema( + description='Methods by which Pokémon can learn moves.', + tags=[ 'moves' ] + ) class MoveLearnMethodResource(PokeapiCommonViewset): queryset = MoveLearnMethod.objects.all() serializer_class = MoveLearnMethodDetailSerializer list_serializer_class = MoveLearnMethodSummarySerializer -@extend_schema(description='Targets moves can be directed at during battle. Targets can be Pokémon, environments or even other moves.') +@extend_schema( + description='Targets moves can be directed at during battle. Targets can be Pokémon, environments or even other moves.', + tags=[ 'moves' ] + ) class MoveTargetResource(PokeapiCommonViewset): queryset = MoveTarget.objects.all() serializer_class = MoveTargetDetailSerializer list_serializer_class = MoveTargetSummarySerializer -@extend_schema(description='Natures influence how a Pokémon\'s stats grow. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Nature) for greater detail.') +@extend_schema( + description='Natures influence how a Pokémon\'s stats grow. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Nature) for greater detail.', + tags=[ 'pokemon' ] + ) class NatureResource(PokeapiCommonViewset): queryset = Nature.objects.all() serializer_class = NatureDetailSerializer list_serializer_class = NatureSummarySerializer -@extend_schema(description='Areas used for grouping Pokémon encounters in Pal Park. They\'re like habitats that are specific to Pal Park.') +@extend_schema( + description='Areas used for grouping Pokémon encounters in Pal Park. They\'re like habitats that are specific to Pal Park.', + tags=[ 'location' ] + ) class PalParkAreaResource(PokeapiCommonViewset): queryset = PalParkArea.objects.all() serializer_class = PalParkAreaDetailSerializer list_serializer_class = PalParkAreaSummarySerializer -@extend_schema(description='Pokeathlon Stats are different attributes of a Pokémon\'s performance in Pokéathlons. In Pokéathlons, competitions happen on different courses; one for each of the different Pokéathlon stats. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9athlon) for greater detail.') +@extend_schema( + description='Pokeathlon Stats are different attributes of a Pokémon\'s performance in Pokéathlons. In Pokéathlons, competitions happen on different courses; one for each of the different Pokéathlon stats. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9athlon) for greater detail.', + tags=[ 'pokemon' ] + ) class PokeathlonStatResource(PokeapiCommonViewset): queryset = PokeathlonStat.objects.all() serializer_class = PokeathlonStatDetailSerializer list_serializer_class = PokeathlonStatSummarySerializer -@extend_schema(description='A Pokédex is a handheld electronic encyclopedia device; one which is capable of recording and retaining information of the various Pokémon in a given region with the exception of the national dex and some smaller dexes related to portions of a region. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Pokedex) for greater detail.') +@extend_schema( + description='A Pokédex is a handheld electronic encyclopedia device; one which is capable of recording and retaining information of the various Pokémon in a given region with the exception of the national dex and some smaller dexes related to portions of a region. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Pokedex) for greater detail.', + tags=[ 'games' ] + ) class PokedexResource(PokeapiCommonViewset): queryset = Pokedex.objects.all() serializer_class = PokedexDetailSerializer list_serializer_class = PokedexSummarySerializer -@extend_schema(description='Colors used for sorting Pokémon in a Pokédex. The color listed in the Pokédex is usually the color most apparent or covering each Pokémon\'s body. No orange category exists; Pokémon that are primarily orange are listed as red or brown.') +@extend_schema( + description='Colors used for sorting Pokémon in a Pokédex. The color listed in the Pokédex is usually the color most apparent or covering each Pokémon\'s body. No orange category exists; Pokémon that are primarily orange are listed as red or brown.', + tags=[ 'pokemon' ] + ) class PokemonColorResource(PokeapiCommonViewset): queryset = PokemonColor.objects.all() serializer_class = PokemonColorDetailSerializer list_serializer_class = PokemonColorSummarySerializer -@extend_schema(description='Some Pokémon may appear in one of multiple, visually different forms. These differences are purely cosmetic. For variations within a Pokémon species, which do differ in more than just visuals, the \'Pokémon\' entity is used to represent such a variety.') +@extend_schema( + description='Some Pokémon may appear in one of multiple, visually different forms. These differences are purely cosmetic. For variations within a Pokémon species, which do differ in more than just visuals, the \'Pokémon\' entity is used to represent such a variety.', + tags=[ 'pokemon' ] + ) class PokemonFormResource(PokeapiCommonViewset): queryset = PokemonForm.objects.all() serializer_class = PokemonFormDetailSerializer list_serializer_class = PokemonFormSummarySerializer -@extend_schema(description='Habitats are generally different terrain Pokémon can be found in but can also be areas designated for rare or legendary Pokémon.') +@extend_schema( + description='Habitats are generally different terrain Pokémon can be found in but can also be areas designated for rare or legendary Pokémon.', + tags=[ 'pokemon' ] + ) class PokemonHabitatResource(PokeapiCommonViewset): queryset = PokemonHabitat.objects.all() serializer_class = PokemonHabitatDetailSerializer list_serializer_class = PokemonHabitatSummarySerializer -@extend_schema(description='Shapes used for sorting Pokémon in a Pokédex.') +@extend_schema( + description='Shapes used for sorting Pokémon in a Pokédex.', + tags=[ 'pokemon' ] + ) class PokemonShapeResource(PokeapiCommonViewset): queryset = PokemonShape.objects.all() serializer_class = PokemonShapeDetailSerializer list_serializer_class = PokemonShapeSummarySerializer -@extend_schema(description='Pokémon are the creatures that inhabit the world of the Pokémon games. They can be caught using Pokéballs and trained by battling with other Pokémon. Each Pokémon belongs to a specific species but may take on a variant which makes it differ from other Pokémon of the same species, such as base stats, available abilities and typings. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9mon_(species)) for greater detail.') +@extend_schema( + description='Pokémon are the creatures that inhabit the world of the Pokémon games. They can be caught using Pokéballs and trained by battling with other Pokémon. Each Pokémon belongs to a specific species but may take on a variant which makes it differ from other Pokémon of the same species, such as base stats, available abilities and typings. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9mon_(species)) for greater detail.', + tags=[ 'pokemon' ] + ) class PokemonResource(PokeapiCommonViewset): queryset = Pokemon.objects.all() serializer_class = PokemonDetailSerializer list_serializer_class = PokemonSummarySerializer -@extend_schema(description='A Pokémon Species forms the basis for at least one Pokémon. Attributes of a Pokémon species are shared across all varieties of Pokémon within the species. A good example is Wormadam; Wormadam is the species which can be found in three different varieties, Wormadam-Trash, Wormadam-Sandy and Wormadam-Plant.') +@extend_schema( + description='A Pokémon Species forms the basis for at least one Pokémon. Attributes of a Pokémon species are shared across all varieties of Pokémon within the species. A good example is Wormadam; Wormadam is the species which can be found in three different varieties, Wormadam-Trash, Wormadam-Sandy and Wormadam-Plant.', + tags=[ 'pokemon' ] + ) class PokemonSpeciesResource(PokeapiCommonViewset): queryset = PokemonSpecies.objects.all().order_by("id") serializer_class = PokemonSpeciesDetailSerializer list_serializer_class = PokemonSpeciesSummarySerializer -@extend_schema(description='A region is an organized area of the Pokémon world. Most often, the main difference between regions is the species of Pokémon that can be encountered within them.') +@extend_schema( + description='A region is an organized area of the Pokémon world. Most often, the main difference between regions is the species of Pokémon that can be encountered within them.', + tags=[ 'location' ] + ) class RegionResource(PokeapiCommonViewset): queryset = Region.objects.all() serializer_class = RegionDetailSerializer list_serializer_class = RegionSummarySerializer -@extend_schema(description='Stats determine certain aspects of battles. Each Pokémon has a value for each stat which grows as they gain levels and can be altered momentarily by effects in battles.') +@extend_schema( + description='Stats determine certain aspects of battles. Each Pokémon has a value for each stat which grows as they gain levels and can be altered momentarily by effects in battles.', + tags=[ 'pokemon' ] + ) class StatResource(PokeapiCommonViewset): queryset = Stat.objects.all() serializer_class = StatDetailSerializer list_serializer_class = StatSummarySerializer -@extend_schema(description='Super contest effects refer to the effects of moves when used in super contests.') +@extend_schema( + description='Super contest effects refer to the effects of moves when used in super contests.', + tags=[ 'contests' ] + ) class SuperContestEffectResource(PokeapiCommonViewset): queryset = SuperContestEffect.objects.all() serializer_class = SuperContestEffectDetailSerializer list_serializer_class = SuperContestEffectSummarySerializer -@extend_schema(description='Types are properties for Pokémon and their moves. Each type has three properties: which types of Pokémon it is super effective against, which types of Pokémon it is not very effective against, and which types of Pokémon it is completely ineffective against.') +@extend_schema( + description='Types are properties for Pokémon and their moves. Each type has three properties: which types of Pokémon it is super effective against, which types of Pokémon it is not very effective against, and which types of Pokémon it is completely ineffective against.', + tags=[ 'pokemon' ] + ) class TypeResource(PokeapiCommonViewset): queryset = Type.objects.all() serializer_class = TypeDetailSerializer list_serializer_class = TypeSummarySerializer -@extend_schema(description='Versions of the games, e.g., Red, Blue or Yellow.') +@extend_schema( + description='Versions of the games, e.g., Red, Blue or Yellow.', + tags=[ 'games' ] + ) class VersionResource(PokeapiCommonViewset): queryset = Version.objects.all() serializer_class = VersionDetailSerializer list_serializer_class = VersionSummarySerializer -@extend_schema(description='Version groups categorize highly similar versions of the games.') +@extend_schema( + description='Version groups categorize highly similar versions of the games.', + tags=[ 'games' ] + ) class VersionGroupResource(PokeapiCommonViewset): queryset = VersionGroup.objects.all() serializer_class = VersionGroupDetailSerializer list_serializer_class = VersionGroupSummarySerializer -@extend_schema(description='Handles Pokemon Encounters as a sub-resource.') +@extend_schema( + description='Handles Pokemon Encounters as a sub-resource.', + tags=[ 'encounters' ] + ) class PokemonEncounterView(APIView): def get(self, request, pokemon_id): From 07471047c5b7a59d4aea264c7919749e16b41a4c Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Wed, 28 Feb 2024 00:26:18 -0600 Subject: [PATCH 16/49] docs(openapi): add path summary --- openapi.yml | 95 +++++++++ pokemon_v2/api.py | 484 ++++++++++++++++++++++++++++++++++++---------- 2 files changed, 481 insertions(+), 98 deletions(-) diff --git a/openapi.yml b/openapi.yml index 34c3c277a..d75c25538 100644 --- a/openapi.yml +++ b/openapi.yml @@ -71,6 +71,7 @@ paths: restoration, stat enhancement, and even damage negation when eaten by Pokémon. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Berry) for greater detail. + summary: List berries parameters: - name: limit required: false @@ -102,6 +103,7 @@ paths: operationId: berry_firmness_list description: Berries can be soft or hard. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Category:Berries_by_firmness) for greater detail. + summary: List berry firmness parameters: - name: limit required: false @@ -133,6 +135,7 @@ paths: operationId: berry_firmness_retrieve description: Berries can be soft or hard. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Category:Berries_by_firmness) for greater detail. + summary: Get berry by firmness parameters: - in: path name: id @@ -159,6 +162,7 @@ paths: description: Flavors determine whether a Pokémon will benefit or suffer from eating a berry based on their **nature**. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Flavor) for greater detail. + summary: List berry flavors parameters: - name: limit required: false @@ -191,6 +195,7 @@ paths: description: Flavors determine whether a Pokémon will benefit or suffer from eating a berry based on their **nature**. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Flavor) for greater detail. + summary: Get berries by flavor parameters: - in: path name: id @@ -218,6 +223,7 @@ paths: restoration, stat enhancement, and even damage negation when eaten by Pokémon. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Berry) for greater detail. + summary: Get a berry parameters: - in: path name: id @@ -245,6 +251,7 @@ paths: IV. A Pokémon's Characteristic is determined by the remainder of its highest IV divided by 5 (gene_modulo). Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Characteristic) for greater detail. + summary: List charecterictics parameters: - name: limit required: false @@ -278,6 +285,7 @@ paths: IV. A Pokémon's Characteristic is determined by the remainder of its highest IV divided by 5 (gene_modulo). Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Characteristic) for greater detail. + summary: Get charecterictic parameters: - in: path name: id @@ -302,6 +310,7 @@ paths: get: operationId: contest_effect_list description: Contest effects refer to the effects of moves when used in contests. + summary: List contest effects parameters: - name: limit required: false @@ -332,6 +341,7 @@ paths: get: operationId: contest_effect_retrieve description: Contest effects refer to the effects of moves when used in contests. + summary: Get contest effect parameters: - in: path name: id @@ -358,6 +368,7 @@ paths: description: Contest types are categories judges used to weigh a Pokémon's condition in Pokémon contests. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Contest_condition) for greater detail. + summary: List contest types parameters: - name: limit required: false @@ -390,6 +401,7 @@ paths: description: Contest types are categories judges used to weigh a Pokémon's condition in Pokémon contests. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Contest_condition) for greater detail. + summary: Get contest type parameters: - in: path name: id @@ -417,6 +429,7 @@ paths: to interbreed. Pokémon may belong to either one or two Egg Groups. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Egg_Group) for greater detail. + summary: List egg groups parameters: - name: limit required: false @@ -450,6 +463,7 @@ paths: to interbreed. Pokémon may belong to either one or two Egg Groups. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Egg_Group) for greater detail. + summary: Get egg group parameters: - in: path name: id @@ -475,6 +489,7 @@ paths: operationId: encounter_condition_list description: Conditions which affect what pokemon might appear in the wild, e.g., day or night. + summary: List encounter conditions parameters: - name: limit required: false @@ -506,6 +521,7 @@ paths: operationId: encounter_condition_value_list description: Encounter condition values are the various states that an encounter condition can have, i.e., time of day can be either day or night. + summary: List encounter condition values parameters: - name: limit required: false @@ -537,6 +553,7 @@ paths: operationId: encounter_condition_value_retrieve description: Encounter condition values are the various states that an encounter condition can have, i.e., time of day can be either day or night. + summary: Get encounter condition value parameters: - in: path name: id @@ -562,6 +579,7 @@ paths: operationId: encounter_condition_retrieve description: Conditions which affect what pokemon might appear in the wild, e.g., day or night. + summary: Get encounter condition parameters: - in: path name: id @@ -587,6 +605,7 @@ paths: operationId: encounter_method_list description: Methods by which the player might can encounter Pokémon in the wild, e.g., walking in tall grass. Check out Bulbapedia for greater detail. + summary: List encounter methods parameters: - name: limit required: false @@ -618,6 +637,7 @@ paths: operationId: encounter_method_retrieve description: Methods by which the player might can encounter Pokémon in the wild, e.g., walking in tall grass. Check out Bulbapedia for greater detail. + summary: Get encounter method parameters: - in: path name: id @@ -644,6 +664,7 @@ paths: description: Evolution chains are essentially family trees. They start with the lowest stage within a family and detail evolution conditions for each as well as Pokémon they can evolve into up through the hierarchy. + summary: List evolution chains parameters: - name: limit required: false @@ -676,6 +697,7 @@ paths: description: Evolution chains are essentially family trees. They start with the lowest stage within a family and detail evolution conditions for each as well as Pokémon they can evolve into up through the hierarchy. + summary: Get evolution chain parameters: - in: path name: id @@ -702,6 +724,7 @@ paths: description: Evolution triggers are the events and conditions that cause a Pokémon to evolve. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Methods_of_evolution) for greater detail. + summary: List evolution triggers parameters: - name: limit required: false @@ -734,6 +757,7 @@ paths: description: Evolution triggers are the events and conditions that cause a Pokémon to evolve. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Methods_of_evolution) for greater detail. + summary: Get evolution trigger parameters: - in: path name: id @@ -761,6 +785,7 @@ paths: Pokémon but can also result in visual differences or even different evolutionary lines. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Gender) for greater detail. + summary: List genders parameters: - name: limit required: false @@ -794,6 +819,7 @@ paths: Pokémon but can also result in visual differences or even different evolutionary lines. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Gender) for greater detail. + summary: Get gender parameters: - in: path name: id @@ -821,6 +847,7 @@ paths: them based on the Pokémon they include. In each generation, a new set of Pokémon, Moves, Abilities and Types that did not exist in the previous generation are released. + summary: List genrations parameters: - name: limit required: false @@ -854,6 +881,7 @@ paths: them based on the Pokémon they include. In each generation, a new set of Pokémon, Moves, Abilities and Types that did not exist in the previous generation are released. + summary: Get genration parameters: - in: path name: id @@ -880,6 +908,7 @@ paths: description: Growth rates are the speed with which Pokémon gain levels through experience. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Experience) for greater detail. + summary: List growth rates parameters: - name: limit required: false @@ -912,6 +941,7 @@ paths: description: Growth rates are the speed with which Pokémon gain levels through experience. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Experience) for greater detail. + summary: Get growth rate parameters: - in: path name: id @@ -938,6 +968,7 @@ paths: description: An item is an object in the games which the player can pick up, keep in their bag, and use in some manner. They have various uses, including healing, powering up, helping catch Pokémon, or to access a new area. + summary: List items parameters: - name: limit required: false @@ -969,6 +1000,7 @@ paths: operationId: item_attribute_list description: Item attributes define particular aspects of items, e.g."usable in battle" or "consumable". + summary: List item attributes parameters: - name: limit required: false @@ -1000,6 +1032,7 @@ paths: operationId: item_attribute_retrieve description: Item attributes define particular aspects of items, e.g."usable in battle" or "consumable". + summary: Get item attribute parameters: - in: path name: id @@ -1025,6 +1058,7 @@ paths: operationId: item_category_list description: Item categories determine where items will be placed in the players bag. + summary: List item categories parameters: - name: limit required: false @@ -1056,6 +1090,7 @@ paths: operationId: item_category_retrieve description: Item categories determine where items will be placed in the players bag. + summary: Get item category parameters: - in: path name: id @@ -1081,6 +1116,7 @@ paths: operationId: item_fling_effect_list description: The various effects of the move"Fling" when used with different items. + summary: List item fling effects parameters: - name: limit required: false @@ -1112,6 +1148,7 @@ paths: operationId: item_fling_effect_retrieve description: The various effects of the move"Fling" when used with different items. + summary: Get item fling effect parameters: - in: path name: id @@ -1136,6 +1173,7 @@ paths: get: operationId: item_pocket_list description: Pockets within the players bag used for storing items by category. + summary: List item pockets parameters: - name: limit required: false @@ -1166,6 +1204,7 @@ paths: get: operationId: item_pocket_retrieve description: Pockets within the players bag used for storing items by category. + summary: Get item pocket parameters: - in: path name: id @@ -1192,6 +1231,7 @@ paths: description: An item is an object in the games which the player can pick up, keep in their bag, and use in some manner. They have various uses, including healing, powering up, helping catch Pokémon, or to access a new area. + summary: Get item parameters: - in: path name: id @@ -1216,6 +1256,7 @@ paths: get: operationId: language_list description: Languages for translations of API resource information. + summary: List languages parameters: - name: limit required: false @@ -1246,6 +1287,7 @@ paths: get: operationId: language_retrieve description: Languages for translations of API resource information. + summary: Get language parameters: - in: path name: id @@ -1271,6 +1313,7 @@ paths: operationId: location_list description: Locations that can be visited within the games. Locations make up sizable portions of regions, like cities or routes. + summary: List locations parameters: - name: limit required: false @@ -1302,6 +1345,7 @@ paths: operationId: location_area_list description: Location areas are sections of areas, such as floors in a building or cave. Each area has its own set of possible Pokémon encounters. + summary: List location areas parameters: - name: limit required: false @@ -1333,6 +1377,7 @@ paths: operationId: location_area_retrieve description: Location areas are sections of areas, such as floors in a building or cave. Each area has its own set of possible Pokémon encounters. + summary: Get location area parameters: - in: path name: id @@ -1358,6 +1403,7 @@ paths: operationId: location_retrieve description: Locations that can be visited within the games. Locations make up sizable portions of regions, like cities or routes. + summary: Get location parameters: - in: path name: id @@ -1384,6 +1430,7 @@ paths: description: Machines are the representation of items that teach moves to Pokémon. They vary from version to version, so it is not certain that one specific TM or HM corresponds to a single Machine. + summary: List machines parameters: - name: limit required: false @@ -1416,6 +1463,7 @@ paths: description: Machines are the representation of items that teach moves to Pokémon. They vary from version to version, so it is not certain that one specific TM or HM corresponds to a single Machine. + summary: Get machine parameters: - in: path name: id @@ -1443,6 +1491,7 @@ paths: uses one move each turn. Some moves (including those learned by Hidden Machine) can be used outside of battle as well, usually for the purpose of removing obstacles or exploring new areas. + summary: List moves parameters: - name: limit required: false @@ -1475,6 +1524,7 @@ paths: description: Move Ailments are status conditions caused by moves used during battle. See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Status_condition) for greater detail. + summary: List move meta ailments parameters: - name: limit required: false @@ -1507,6 +1557,7 @@ paths: description: Move Ailments are status conditions caused by moves used during battle. See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Status_condition) for greater detail. + summary: Get move meta ailment parameters: - in: path name: id @@ -1532,6 +1583,7 @@ paths: operationId: move_battle_style_list description: Styles of moves when used in the Battle Palace. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Battle_Frontier_(Generation_III)) for greater detail. + summary: List move battle styles parameters: - name: limit required: false @@ -1563,6 +1615,7 @@ paths: operationId: move_battle_style_retrieve description: Styles of moves when used in the Battle Palace. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Battle_Frontier_(Generation_III)) for greater detail. + summary: Get move battle style parameters: - in: path name: id @@ -1587,6 +1640,7 @@ paths: get: operationId: move_category_list description: Very general categories that loosely group move effects. + summary: List move meta categories parameters: - name: limit required: false @@ -1617,6 +1671,7 @@ paths: get: operationId: move_category_retrieve description: Very general categories that loosely group move effects. + summary: Get move meta category parameters: - in: path name: id @@ -1641,6 +1696,7 @@ paths: get: operationId: move_damage_class_list description: Damage classes moves can have, e.g. physical, special, or non-damaging. + summary: List move damage classes parameters: - name: limit required: false @@ -1671,6 +1727,7 @@ paths: get: operationId: move_damage_class_retrieve description: Damage classes moves can have, e.g. physical, special, or non-damaging. + summary: Get move damage class parameters: - in: path name: id @@ -1695,6 +1752,7 @@ paths: get: operationId: move_learn_method_list description: Methods by which Pokémon can learn moves. + summary: List move learn methods parameters: - name: limit required: false @@ -1725,6 +1783,7 @@ paths: get: operationId: move_learn_method_retrieve description: Methods by which Pokémon can learn moves. + summary: Get move learn method parameters: - in: path name: id @@ -1750,6 +1809,7 @@ paths: operationId: move_target_list description: Targets moves can be directed at during battle. Targets can be Pokémon, environments or even other moves. + summary: List move targets parameters: - name: limit required: false @@ -1781,6 +1841,7 @@ paths: operationId: move_target_retrieve description: Targets moves can be directed at during battle. Targets can be Pokémon, environments or even other moves. + summary: Get move target parameters: - in: path name: id @@ -1808,6 +1869,7 @@ paths: uses one move each turn. Some moves (including those learned by Hidden Machine) can be used outside of battle as well, usually for the purpose of removing obstacles or exploring new areas. + summary: Get move parameters: - in: path name: id @@ -1833,6 +1895,7 @@ paths: operationId: nature_list description: Natures influence how a Pokémon's stats grow. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Nature) for greater detail. + summary: List natures parameters: - name: limit required: false @@ -1864,6 +1927,7 @@ paths: operationId: nature_retrieve description: Natures influence how a Pokémon's stats grow. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Nature) for greater detail. + summary: Get nature parameters: - in: path name: id @@ -1889,6 +1953,7 @@ paths: operationId: pal_park_area_list description: Areas used for grouping Pokémon encounters in Pal Park. They're like habitats that are specific to Pal Park. + summary: List pal park areas parameters: - name: limit required: false @@ -1920,6 +1985,7 @@ paths: operationId: pal_park_area_retrieve description: Areas used for grouping Pokémon encounters in Pal Park. They're like habitats that are specific to Pal Park. + summary: Get pal park area parameters: - in: path name: id @@ -1947,6 +2013,7 @@ paths: in Pokéathlons. In Pokéathlons, competitions happen on different courses; one for each of the different Pokéathlon stats. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9athlon) for greater detail. + summary: List pokeathlon stats parameters: - name: limit required: false @@ -1980,6 +2047,7 @@ paths: in Pokéathlons. In Pokéathlons, competitions happen on different courses; one for each of the different Pokéathlon stats. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9athlon) for greater detail. + summary: Get pokeathlon stat parameters: - in: path name: id @@ -2008,6 +2076,7 @@ paths: a given region with the exception of the national dex and some smaller dexes related to portions of a region. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Pokedex) for greater detail. + summary: List pokedex parameters: - name: limit required: false @@ -2042,6 +2111,7 @@ paths: a given region with the exception of the national dex and some smaller dexes related to portions of a region. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Pokedex) for greater detail. + summary: Get pokedex parameters: - in: path name: id @@ -2071,6 +2141,7 @@ paths: which makes it differ from other Pokémon of the same species, such as base stats, available abilities and typings. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9mon_(species)) for greater detail. + summary: List pokemon parameters: - name: limit required: false @@ -2104,6 +2175,7 @@ paths: in the Pokédex is usually the color most apparent or covering each Pokémon's body. No orange category exists; Pokémon that are primarily orange are listed as red or brown. + summary: List pokemon colors parameters: - name: limit required: false @@ -2137,6 +2209,7 @@ paths: in the Pokédex is usually the color most apparent or covering each Pokémon's body. No orange category exists; Pokémon that are primarily orange are listed as red or brown. + summary: Get pokemon color parameters: - in: path name: id @@ -2164,6 +2237,7 @@ paths: forms. These differences are purely cosmetic. For variations within a Pokémon species, which do differ in more than just visuals, the 'Pokémon' entity is used to represent such a variety. + summary: List pokemon forms parameters: - name: limit required: false @@ -2197,6 +2271,7 @@ paths: forms. These differences are purely cosmetic. For variations within a Pokémon species, which do differ in more than just visuals, the 'Pokémon' entity is used to represent such a variety. + summary: Get pokemon form parameters: - in: path name: id @@ -2222,6 +2297,7 @@ paths: operationId: pokemon_habitat_list description: Habitats are generally different terrain Pokémon can be found in but can also be areas designated for rare or legendary Pokémon. + summary: List pokemom habitas parameters: - name: limit required: false @@ -2253,6 +2329,7 @@ paths: operationId: pokemon_habitat_retrieve description: Habitats are generally different terrain Pokémon can be found in but can also be areas designated for rare or legendary Pokémon. + summary: Get pokemom habita parameters: - in: path name: id @@ -2277,6 +2354,7 @@ paths: get: operationId: pokemon_shape_list description: Shapes used for sorting Pokémon in a Pokédex. + summary: List pokemon shapes parameters: - name: limit required: false @@ -2307,6 +2385,7 @@ paths: get: operationId: pokemon_shape_retrieve description: Shapes used for sorting Pokémon in a Pokédex. + summary: Get pokemon shape parameters: - in: path name: id @@ -2334,6 +2413,7 @@ paths: of a Pokémon species are shared across all varieties of Pokémon within the species. A good example is Wormadam; Wormadam is the species which can be found in three different varieties, Wormadam-Trash, Wormadam-Sandy and Wormadam-Plant. + summary: List pokemon specs parameters: - name: limit required: false @@ -2367,6 +2447,7 @@ paths: of a Pokémon species are shared across all varieties of Pokémon within the species. A good example is Wormadam; Wormadam is the species which can be found in three different varieties, Wormadam-Trash, Wormadam-Sandy and Wormadam-Plant. + summary: Get pokemon spec parameters: - in: path name: id @@ -2396,6 +2477,7 @@ paths: which makes it differ from other Pokémon of the same species, such as base stats, available abilities and typings. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9mon_(species)) for greater detail. + summary: Get pokemon parameters: - in: path name: id @@ -2420,6 +2502,7 @@ paths: get: operationId: pokemon_encounters_retrieve description: Handles Pokemon Encounters as a sub-resource. + summary: Get pokemon encounter parameters: - in: path name: pokemon_id @@ -2442,6 +2525,7 @@ paths: description: A region is an organized area of the Pokémon world. Most often, the main difference between regions is the species of Pokémon that can be encountered within them. + summary: List regions parameters: - name: limit required: false @@ -2474,6 +2558,7 @@ paths: description: A region is an organized area of the Pokémon world. Most often, the main difference between regions is the species of Pokémon that can be encountered within them. + summary: Get region parameters: - in: path name: id @@ -2500,6 +2585,7 @@ paths: description: Stats determine certain aspects of battles. Each Pokémon has a value for each stat which grows as they gain levels and can be altered momentarily by effects in battles. + summary: List stats parameters: - name: limit required: false @@ -2532,6 +2618,7 @@ paths: description: Stats determine certain aspects of battles. Each Pokémon has a value for each stat which grows as they gain levels and can be altered momentarily by effects in battles. + summary: Get stat parameters: - in: path name: id @@ -2557,6 +2644,7 @@ paths: operationId: super_contest_effect_list description: Super contest effects refer to the effects of moves when used in super contests. + summary: List super contest effects parameters: - name: limit required: false @@ -2588,6 +2676,7 @@ paths: operationId: super_contest_effect_retrieve description: Super contest effects refer to the effects of moves when used in super contests. + summary: Get super contest effect parameters: - in: path name: id @@ -2615,6 +2704,7 @@ paths: three properties: which types of Pokémon it is super effective against, which types of Pokémon it is not very effective against, and which types of Pokémon it is completely ineffective against.' + summary: List types parameters: - name: limit required: false @@ -2648,6 +2738,7 @@ paths: three properties: which types of Pokémon it is super effective against, which types of Pokémon it is not very effective against, and which types of Pokémon it is completely ineffective against.' + summary: List types parameters: - in: path name: id @@ -2672,6 +2763,7 @@ paths: get: operationId: version_list description: Versions of the games, e.g., Red, Blue or Yellow. + summary: List versions parameters: - name: limit required: false @@ -2702,6 +2794,7 @@ paths: get: operationId: version_group_list description: Version groups categorize highly similar versions of the games. + summary: List version groups parameters: - name: limit required: false @@ -2732,6 +2825,7 @@ paths: get: operationId: version_group_retrieve description: Version groups categorize highly similar versions of the games. + summary: Get version group parameters: - in: path name: id @@ -2756,6 +2850,7 @@ paths: get: operationId: version_retrieve description: Versions of the games, e.g., Red, Blue or Yellow. + summary: Get version parameters: - in: path name: id diff --git a/pokemon_v2/api.py b/pokemon_v2/api.py index 8dcd1c1fe..1737680a9 100644 --- a/pokemon_v2/api.py +++ b/pokemon_v2/api.py @@ -4,7 +4,7 @@ from rest_framework.views import APIView from django.shortcuts import get_object_or_404 from django.http import Http404 -from drf_spectacular.utils import extend_schema +from drf_spectacular.utils import extend_schema, extend_schema_serializer, extend_schema_view from .models import * from .serializers import * @@ -73,7 +73,7 @@ class PokeapiCommonViewset( @extend_schema( description='Abilities provide passive effects for Pokémon in battle or in the overworld. Pokémon have multiple possible abilities but can have only one ability at a time. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Ability) for greater detail.', - tags=[ 'pokemon' ] + tags=[ 'pokemon' ], ) class AbilityResource(PokeapiCommonViewset): queryset = Ability.objects.all() @@ -83,8 +83,14 @@ class AbilityResource(PokeapiCommonViewset): @extend_schema( description='Berries are small fruits that can provide HP and status condition restoration, stat enhancement, and even damage negation when eaten by Pokémon. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Berry) for greater detail.', - tags=[ 'berries' ] - ) + tags=[ 'berries' ], + summary='Get a berry', + ) +@extend_schema_view( + list=extend_schema( + summary='List berries', + ) +) class BerryResource(PokeapiCommonViewset): queryset = Berry.objects.all() serializer_class = BerryDetailSerializer @@ -93,8 +99,14 @@ class BerryResource(PokeapiCommonViewset): @extend_schema( description='Berries can be soft or hard. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Category:Berries_by_firmness) for greater detail.', - tags=[ 'berries' ] - ) + tags=[ 'berries' ], + summary='Get berry by firmness', + ) +@extend_schema_view( + list=extend_schema( + summary='List berry firmness', + ) +) class BerryFirmnessResource(PokeapiCommonViewset): queryset = BerryFirmness.objects.all() serializer_class = BerryFirmnessDetailSerializer @@ -103,8 +115,14 @@ class BerryFirmnessResource(PokeapiCommonViewset): @extend_schema( description='Flavors determine whether a Pokémon will benefit or suffer from eating a berry based on their **nature**. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Flavor) for greater detail.', - tags=[ 'berries' ] - ) + summary='Get berries by flavor', + tags=[ 'berries' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List berry flavors', + ) +) class BerryFlavorResource(PokeapiCommonViewset): queryset = BerryFlavor.objects.all() serializer_class = BerryFlavorDetailSerializer @@ -113,8 +131,14 @@ class BerryFlavorResource(PokeapiCommonViewset): @extend_schema( description='Characteristics indicate which stat contains a Pokémon\'s highest IV. A Pokémon\'s Characteristic is determined by the remainder of its highest IV divided by 5 (gene_modulo). Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Characteristic) for greater detail.', - tags=[ 'pokemon' ] - ) + summary='Get charecterictic', + tags=[ 'pokemon' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List charecterictics', + ) +) class CharacteristicResource(PokeapiCommonViewset): queryset = Characteristic.objects.all() serializer_class = CharacteristicDetailSerializer @@ -123,8 +147,14 @@ class CharacteristicResource(PokeapiCommonViewset): @extend_schema( description='Contest effects refer to the effects of moves when used in contests.', - tags=[ 'contests' ] - ) + tags=[ 'contests' ], + summary='Get contest effect', + ) +@extend_schema_view( + list=extend_schema( + summary='List contest effects', + ) +) class ContestEffectResource(PokeapiCommonViewset): queryset = ContestEffect.objects.all() serializer_class = ContestEffectDetailSerializer @@ -133,8 +163,14 @@ class ContestEffectResource(PokeapiCommonViewset): @extend_schema( description='Contest types are categories judges used to weigh a Pokémon\'s condition in Pokémon contests. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Contest_condition) for greater detail.', - tags=[ 'contests' ] - ) + summary='Get contest type', + tags=[ 'contests' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List contest types', + ) +) class ContestTypeResource(PokeapiCommonViewset): queryset = ContestType.objects.all() serializer_class = ContestTypeDetailSerializer @@ -143,8 +179,14 @@ class ContestTypeResource(PokeapiCommonViewset): @extend_schema( description='Egg Groups are categories which determine which Pokémon are able to interbreed. Pokémon may belong to either one or two Egg Groups. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Egg_Group) for greater detail.', - tags=[ 'pokemon' ] - ) + summary='Get egg group', + tags=[ 'pokemon' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List egg groups', + ) +) class EggGroupResource(PokeapiCommonViewset): queryset = EggGroup.objects.all() serializer_class = EggGroupDetailSerializer @@ -153,8 +195,14 @@ class EggGroupResource(PokeapiCommonViewset): @extend_schema( description='Conditions which affect what pokemon might appear in the wild, e.g., day or night.', - tags=[ 'encounters' ] - ) + summary='Get encounter condition', + tags=[ 'encounters' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List encounter conditions', + ) +) class EncounterConditionResource(PokeapiCommonViewset): queryset = EncounterCondition.objects.all() serializer_class = EncounterConditionDetailSerializer @@ -163,8 +211,14 @@ class EncounterConditionResource(PokeapiCommonViewset): @extend_schema( description='Encounter condition values are the various states that an encounter condition can have, i.e., time of day can be either day or night.', - tags=[ 'encounters' ] - ) + summary='Get encounter condition value', + tags=[ 'encounters' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List encounter condition values', + ) +) class EncounterConditionValueResource(PokeapiCommonViewset): queryset = EncounterConditionValue.objects.all() serializer_class = EncounterConditionValueDetailSerializer @@ -173,8 +227,14 @@ class EncounterConditionValueResource(PokeapiCommonViewset): @extend_schema( description='Methods by which the player might can encounter Pokémon in the wild, e.g., walking in tall grass. Check out Bulbapedia for greater detail.', - tags=[ 'encounters' ] - ) + summary='Get encounter method', + tags=[ 'encounters' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List encounter methods', + ) +) class EncounterMethodResource(PokeapiCommonViewset): queryset = EncounterMethod.objects.all() serializer_class = EncounterMethodDetailSerializer @@ -183,8 +243,14 @@ class EncounterMethodResource(PokeapiCommonViewset): @extend_schema( description='Evolution chains are essentially family trees. They start with the lowest stage within a family and detail evolution conditions for each as well as Pokémon they can evolve into up through the hierarchy.', - tags=[ 'evolution' ] - ) + summary='Get evolution chain', + tags=[ 'evolution' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List evolution chains', + ) +) class EvolutionChainResource(PokeapiCommonViewset): queryset = EvolutionChain.objects.all() serializer_class = EvolutionChainDetailSerializer @@ -193,8 +259,14 @@ class EvolutionChainResource(PokeapiCommonViewset): @extend_schema( description='Evolution triggers are the events and conditions that cause a Pokémon to evolve. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Methods_of_evolution) for greater detail.', - tags=[ 'evolution' ] - ) + summary='Get evolution trigger', + tags=[ 'evolution' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List evolution triggers', + ) +) class EvolutionTriggerResource(PokeapiCommonViewset): queryset = EvolutionTrigger.objects.all() serializer_class = EvolutionTriggerDetailSerializer @@ -203,8 +275,14 @@ class EvolutionTriggerResource(PokeapiCommonViewset): @extend_schema( description='A generation is a grouping of the Pokémon games that separates them based on the Pokémon they include. In each generation, a new set of Pokémon, Moves, Abilities and Types that did not exist in the previous generation are released.', - tags=[ 'games' ] - ) + summary='Get genration', + tags=[ 'games' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List genrations', + ) +) class GenerationResource(PokeapiCommonViewset): queryset = Generation.objects.all() serializer_class = GenerationDetailSerializer @@ -213,8 +291,14 @@ class GenerationResource(PokeapiCommonViewset): @extend_schema( description='Genders were introduced in Generation II for the purposes of breeding Pokémon but can also result in visual differences or even different evolutionary lines. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Gender) for greater detail.', - tags=[ 'pokemon' ] - ) + summary='Get gender', + tags=[ 'pokemon' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List genders', + ) +) class GenderResource(PokeapiCommonViewset): queryset = Gender.objects.all() serializer_class = GenderDetailSerializer @@ -223,8 +307,14 @@ class GenderResource(PokeapiCommonViewset): @extend_schema( description='Growth rates are the speed with which Pokémon gain levels through experience. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Experience) for greater detail.', - tags=[ 'pokemon' ] - ) + summary='Get growth rate', + tags=[ 'pokemon' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List growth rates', + ) +) class GrowthRateResource(PokeapiCommonViewset): queryset = GrowthRate.objects.all() serializer_class = GrowthRateDetailSerializer @@ -233,8 +323,14 @@ class GrowthRateResource(PokeapiCommonViewset): @extend_schema( description='An item is an object in the games which the player can pick up, keep in their bag, and use in some manner. They have various uses, including healing, powering up, helping catch Pokémon, or to access a new area.', - tags=[ 'items' ] - ) + summary='Get item', + tags=[ 'items' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List items', + ) +) class ItemResource(PokeapiCommonViewset): queryset = Item.objects.all() serializer_class = ItemDetailSerializer @@ -243,8 +339,14 @@ class ItemResource(PokeapiCommonViewset): @extend_schema( description='Item categories determine where items will be placed in the players bag.', - tags=[ 'items' ] - ) + summary='Get item category', + tags=[ 'items' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List item categories', + ) +) class ItemCategoryResource(PokeapiCommonViewset): queryset = ItemCategory.objects.all() serializer_class = ItemCategoryDetailSerializer @@ -253,8 +355,14 @@ class ItemCategoryResource(PokeapiCommonViewset): @extend_schema( description='Item attributes define particular aspects of items, e.g."usable in battle" or "consumable".', - tags=[ 'items' ] - ) + summary='Get item attribute', + tags=[ 'items' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List item attributes', + ) +) class ItemAttributeResource(PokeapiCommonViewset): queryset = ItemAttribute.objects.all() serializer_class = ItemAttributeDetailSerializer @@ -263,8 +371,14 @@ class ItemAttributeResource(PokeapiCommonViewset): @extend_schema( description='The various effects of the move"Fling" when used with different items.', - tags=[ 'items' ] - ) + summary='Get item fling effect', + tags=[ 'items' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List item fling effects', + ) +) class ItemFlingEffectResource(PokeapiCommonViewset): queryset = ItemFlingEffect.objects.all() serializer_class = ItemFlingEffectDetailSerializer @@ -273,8 +387,14 @@ class ItemFlingEffectResource(PokeapiCommonViewset): @extend_schema( description='Pockets within the players bag used for storing items by category.', - tags=[ 'items' ] - ) + summary='Get item pocket', + tags=[ 'items' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List item pockets', + ) +) class ItemPocketResource(PokeapiCommonViewset): queryset = ItemPocket.objects.all() serializer_class = ItemPocketDetailSerializer @@ -283,8 +403,14 @@ class ItemPocketResource(PokeapiCommonViewset): @extend_schema( description='Languages for translations of API resource information.', - tags=[ 'utility' ] - ) + summary='Get language', + tags=[ 'utility' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List languages', + ) +) class LanguageResource(PokeapiCommonViewset): queryset = Language.objects.all() serializer_class = LanguageDetailSerializer @@ -293,8 +419,14 @@ class LanguageResource(PokeapiCommonViewset): @extend_schema( description='Locations that can be visited within the games. Locations make up sizable portions of regions, like cities or routes.', - tags=[ 'location' ] - ) + summary='Get location', + tags=[ 'location' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List locations', + ) +) class LocationResource(PokeapiCommonViewset): queryset = Location.objects.all() serializer_class = LocationDetailSerializer @@ -303,8 +435,14 @@ class LocationResource(PokeapiCommonViewset): @extend_schema( description='Location areas are sections of areas, such as floors in a building or cave. Each area has its own set of possible Pokémon encounters.', - tags=[ 'location' ] - ) + summary='Get location area', + tags=[ 'location' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List location areas', + ) +) class LocationAreaResource(ListOrDetailSerialRelation, viewsets.ReadOnlyModelViewSet): queryset = LocationArea.objects.all() serializer_class = LocationAreaDetailSerializer @@ -313,8 +451,14 @@ class LocationAreaResource(ListOrDetailSerialRelation, viewsets.ReadOnlyModelVie @extend_schema( description='Machines are the representation of items that teach moves to Pokémon. They vary from version to version, so it is not certain that one specific TM or HM corresponds to a single Machine.', - tags=[ 'machines' ] - ) + summary='Get machine', + tags=[ 'machines' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List machines', + ) +) class MachineResource(PokeapiCommonViewset): queryset = Machine.objects.all() serializer_class = MachineDetailSerializer @@ -323,8 +467,14 @@ class MachineResource(PokeapiCommonViewset): @extend_schema( description='Moves are the skills of Pokémon in battle. In battle, a Pokémon uses one move each turn. Some moves (including those learned by Hidden Machine) can be used outside of battle as well, usually for the purpose of removing obstacles or exploring new areas.', - tags=[ 'moves' ] - ) + summary='Get move', + tags=[ 'moves' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List moves', + ) +) class MoveResource(PokeapiCommonViewset): queryset = Move.objects.all() serializer_class = MoveDetailSerializer @@ -333,8 +483,14 @@ class MoveResource(PokeapiCommonViewset): @extend_schema( description='Damage classes moves can have, e.g. physical, special, or non-damaging.', - tags=[ 'pokemon' ] - ) + summary='Get move damage class', + tags=[ 'pokemon' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List move damage classes', + ) +) class MoveDamageClassResource(PokeapiCommonViewset): queryset = MoveDamageClass.objects.all() serializer_class = MoveDamageClassDetailSerializer @@ -343,8 +499,14 @@ class MoveDamageClassResource(PokeapiCommonViewset): @extend_schema( description='Move Ailments are status conditions caused by moves used during battle. See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Status_condition) for greater detail.', - tags=[ 'moves' ] - ) + summary='Get move meta ailment', + tags=[ 'moves' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List move meta ailments', + ) +) class MoveMetaAilmentResource(PokeapiCommonViewset): queryset = MoveMetaAilment.objects.all() serializer_class = MoveMetaAilmentDetailSerializer @@ -353,8 +515,14 @@ class MoveMetaAilmentResource(PokeapiCommonViewset): @extend_schema( description='Styles of moves when used in the Battle Palace. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Battle_Frontier_(Generation_III)) for greater detail.', - tags=[ 'moves' ] - ) + summary='Get move battle style', + tags=[ 'moves' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List move battle styles', + ) +) class MoveBattleStyleResource(PokeapiCommonViewset): queryset = MoveBattleStyle.objects.all() serializer_class = MoveBattleStyleDetailSerializer @@ -363,8 +531,14 @@ class MoveBattleStyleResource(PokeapiCommonViewset): @extend_schema( description='Very general categories that loosely group move effects.', - tags=[ 'moves' ] - ) + summary='Get move meta category', + tags=[ 'moves' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List move meta categories', + ) +) class MoveMetaCategoryResource(PokeapiCommonViewset): queryset = MoveMetaCategory.objects.all() serializer_class = MoveMetaCategoryDetailSerializer @@ -373,8 +547,14 @@ class MoveMetaCategoryResource(PokeapiCommonViewset): @extend_schema( description='Methods by which Pokémon can learn moves.', - tags=[ 'moves' ] - ) + summary='Get move learn method', + tags=[ 'moves' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List move learn methods', + ) +) class MoveLearnMethodResource(PokeapiCommonViewset): queryset = MoveLearnMethod.objects.all() serializer_class = MoveLearnMethodDetailSerializer @@ -383,8 +563,14 @@ class MoveLearnMethodResource(PokeapiCommonViewset): @extend_schema( description='Targets moves can be directed at during battle. Targets can be Pokémon, environments or even other moves.', - tags=[ 'moves' ] - ) + summary='Get move target', + tags=[ 'moves' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List move targets', + ) +) class MoveTargetResource(PokeapiCommonViewset): queryset = MoveTarget.objects.all() serializer_class = MoveTargetDetailSerializer @@ -393,8 +579,14 @@ class MoveTargetResource(PokeapiCommonViewset): @extend_schema( description='Natures influence how a Pokémon\'s stats grow. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Nature) for greater detail.', - tags=[ 'pokemon' ] - ) + summary='Get nature', + tags=[ 'pokemon' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List natures', + ) +) class NatureResource(PokeapiCommonViewset): queryset = Nature.objects.all() serializer_class = NatureDetailSerializer @@ -403,8 +595,14 @@ class NatureResource(PokeapiCommonViewset): @extend_schema( description='Areas used for grouping Pokémon encounters in Pal Park. They\'re like habitats that are specific to Pal Park.', - tags=[ 'location' ] - ) + summary='Get pal park area', + tags=[ 'location' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List pal park areas', + ) +) class PalParkAreaResource(PokeapiCommonViewset): queryset = PalParkArea.objects.all() serializer_class = PalParkAreaDetailSerializer @@ -413,8 +611,14 @@ class PalParkAreaResource(PokeapiCommonViewset): @extend_schema( description='Pokeathlon Stats are different attributes of a Pokémon\'s performance in Pokéathlons. In Pokéathlons, competitions happen on different courses; one for each of the different Pokéathlon stats. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9athlon) for greater detail.', - tags=[ 'pokemon' ] - ) + summary='Get pokeathlon stat', + tags=[ 'pokemon' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List pokeathlon stats', + ) +) class PokeathlonStatResource(PokeapiCommonViewset): queryset = PokeathlonStat.objects.all() serializer_class = PokeathlonStatDetailSerializer @@ -423,8 +627,14 @@ class PokeathlonStatResource(PokeapiCommonViewset): @extend_schema( description='A Pokédex is a handheld electronic encyclopedia device; one which is capable of recording and retaining information of the various Pokémon in a given region with the exception of the national dex and some smaller dexes related to portions of a region. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Pokedex) for greater detail.', - tags=[ 'games' ] - ) + summary='Get pokedex', + tags=[ 'games' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List pokedex', + ) +) class PokedexResource(PokeapiCommonViewset): queryset = Pokedex.objects.all() serializer_class = PokedexDetailSerializer @@ -433,8 +643,14 @@ class PokedexResource(PokeapiCommonViewset): @extend_schema( description='Colors used for sorting Pokémon in a Pokédex. The color listed in the Pokédex is usually the color most apparent or covering each Pokémon\'s body. No orange category exists; Pokémon that are primarily orange are listed as red or brown.', - tags=[ 'pokemon' ] - ) + summary='Get pokemon color', + tags=[ 'pokemon' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List pokemon colors', + ) +) class PokemonColorResource(PokeapiCommonViewset): queryset = PokemonColor.objects.all() serializer_class = PokemonColorDetailSerializer @@ -443,8 +659,14 @@ class PokemonColorResource(PokeapiCommonViewset): @extend_schema( description='Some Pokémon may appear in one of multiple, visually different forms. These differences are purely cosmetic. For variations within a Pokémon species, which do differ in more than just visuals, the \'Pokémon\' entity is used to represent such a variety.', - tags=[ 'pokemon' ] - ) + summary='Get pokemon form', + tags=[ 'pokemon' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List pokemon forms', + ) +) class PokemonFormResource(PokeapiCommonViewset): queryset = PokemonForm.objects.all() serializer_class = PokemonFormDetailSerializer @@ -453,8 +675,14 @@ class PokemonFormResource(PokeapiCommonViewset): @extend_schema( description='Habitats are generally different terrain Pokémon can be found in but can also be areas designated for rare or legendary Pokémon.', - tags=[ 'pokemon' ] - ) + summary='Get pokemom habita', + tags=[ 'pokemon' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List pokemom habitas', + ) +) class PokemonHabitatResource(PokeapiCommonViewset): queryset = PokemonHabitat.objects.all() serializer_class = PokemonHabitatDetailSerializer @@ -463,8 +691,14 @@ class PokemonHabitatResource(PokeapiCommonViewset): @extend_schema( description='Shapes used for sorting Pokémon in a Pokédex.', - tags=[ 'pokemon' ] - ) + summary='Get pokemon shape', + tags=[ 'pokemon' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List pokemon shapes', + ) +) class PokemonShapeResource(PokeapiCommonViewset): queryset = PokemonShape.objects.all() serializer_class = PokemonShapeDetailSerializer @@ -473,8 +707,14 @@ class PokemonShapeResource(PokeapiCommonViewset): @extend_schema( description='Pokémon are the creatures that inhabit the world of the Pokémon games. They can be caught using Pokéballs and trained by battling with other Pokémon. Each Pokémon belongs to a specific species but may take on a variant which makes it differ from other Pokémon of the same species, such as base stats, available abilities and typings. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9mon_(species)) for greater detail.', - tags=[ 'pokemon' ] - ) + summary='Get pokemon', + tags=[ 'pokemon' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List pokemon', + ) +) class PokemonResource(PokeapiCommonViewset): queryset = Pokemon.objects.all() serializer_class = PokemonDetailSerializer @@ -483,8 +723,14 @@ class PokemonResource(PokeapiCommonViewset): @extend_schema( description='A Pokémon Species forms the basis for at least one Pokémon. Attributes of a Pokémon species are shared across all varieties of Pokémon within the species. A good example is Wormadam; Wormadam is the species which can be found in three different varieties, Wormadam-Trash, Wormadam-Sandy and Wormadam-Plant.', - tags=[ 'pokemon' ] - ) + summary='Get pokemon spec', + tags=[ 'pokemon' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List pokemon specs', + ) +) class PokemonSpeciesResource(PokeapiCommonViewset): queryset = PokemonSpecies.objects.all().order_by("id") serializer_class = PokemonSpeciesDetailSerializer @@ -493,8 +739,14 @@ class PokemonSpeciesResource(PokeapiCommonViewset): @extend_schema( description='A region is an organized area of the Pokémon world. Most often, the main difference between regions is the species of Pokémon that can be encountered within them.', - tags=[ 'location' ] - ) + summary='Get region', + tags=[ 'location' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List regions', + ) +) class RegionResource(PokeapiCommonViewset): queryset = Region.objects.all() serializer_class = RegionDetailSerializer @@ -503,8 +755,14 @@ class RegionResource(PokeapiCommonViewset): @extend_schema( description='Stats determine certain aspects of battles. Each Pokémon has a value for each stat which grows as they gain levels and can be altered momentarily by effects in battles.', - tags=[ 'pokemon' ] - ) + summary='Get stat', + tags=[ 'pokemon' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List stats', + ) +) class StatResource(PokeapiCommonViewset): queryset = Stat.objects.all() serializer_class = StatDetailSerializer @@ -513,8 +771,14 @@ class StatResource(PokeapiCommonViewset): @extend_schema( description='Super contest effects refer to the effects of moves when used in super contests.', - tags=[ 'contests' ] - ) + summary='Get super contest effect', + tags=[ 'contests' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List super contest effects', + ) +) class SuperContestEffectResource(PokeapiCommonViewset): queryset = SuperContestEffect.objects.all() serializer_class = SuperContestEffectDetailSerializer @@ -523,8 +787,14 @@ class SuperContestEffectResource(PokeapiCommonViewset): @extend_schema( description='Types are properties for Pokémon and their moves. Each type has three properties: which types of Pokémon it is super effective against, which types of Pokémon it is not very effective against, and which types of Pokémon it is completely ineffective against.', - tags=[ 'pokemon' ] - ) + summary='List types', + tags=[ 'pokemon' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List types', + ) +) class TypeResource(PokeapiCommonViewset): queryset = Type.objects.all() serializer_class = TypeDetailSerializer @@ -533,8 +803,14 @@ class TypeResource(PokeapiCommonViewset): @extend_schema( description='Versions of the games, e.g., Red, Blue or Yellow.', - tags=[ 'games' ] - ) + summary='Get version', + tags=[ 'games' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List versions', + ) +) class VersionResource(PokeapiCommonViewset): queryset = Version.objects.all() serializer_class = VersionDetailSerializer @@ -543,8 +819,14 @@ class VersionResource(PokeapiCommonViewset): @extend_schema( description='Version groups categorize highly similar versions of the games.', - tags=[ 'games' ] - ) + summary='Get version group', + tags=[ 'games' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List version groups', + ) +) class VersionGroupResource(PokeapiCommonViewset): queryset = VersionGroup.objects.all() serializer_class = VersionGroupDetailSerializer @@ -553,8 +835,14 @@ class VersionGroupResource(PokeapiCommonViewset): @extend_schema( description='Handles Pokemon Encounters as a sub-resource.', - tags=[ 'encounters' ] - ) + summary='Get pokemon encounter', + tags=[ 'encounters' ], + ) +@extend_schema_view( + list=extend_schema( + summary='List pokemon encounters', + ) +) class PokemonEncounterView(APIView): def get(self, request, pokemon_id): From 61c4cd084d425a03653aaee22c18d61ebff07ea4 Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Fri, 1 Mar 2024 03:54:51 -0600 Subject: [PATCH 17/49] fix: resolve drf-spectacular warnings, add schema_field definitions --- openapi.yml | 717 ++++++++++++++++++++++++++++++++++---- pokemon_v2/serializers.py | 712 +++++++++++++++++++++++++++++++++++++ 2 files changed, 1367 insertions(+), 62 deletions(-) diff --git a/openapi.yml b/openapi.yml index d75c25538..5d90c1e36 100644 --- a/openapi.yml +++ b/openapi.yml @@ -2738,7 +2738,7 @@ paths: three properties: which types of Pokémon it is super effective against, which types of Pokémon it is not very effective against, and which types of Pokémon it is completely ineffective against.' - summary: List types + summary: Get types parameters: - in: path name: id @@ -2931,7 +2931,8 @@ components: $ref: '#/components/schemas/AbilityFlavorText' readOnly: true pokemon: - type: string + type: object + additionalProperties: {} readOnly: true required: - effect_changes @@ -3030,7 +3031,31 @@ components: firmness: $ref: '#/components/schemas/BerryFirmnessSummary' flavors: - type: string + type: array + items: + type: object + required: + - potency + - flavor + properties: + potency: + type: integer + example: 10 + flavor: + type: object + require: + - name + - url + properties: + name: + type: string + description: The name of the flavor + example: spicy + url: + type: string + format: uri + description: The URL to get more information about the flavor + example: https://pokeapi.co/api/v2/berry-flavor/1/ readOnly: true item: $ref: '#/components/schemas/ItemSummary' @@ -3107,7 +3132,31 @@ components: type: string maxLength: 100 berries: - type: string + type: array + items: + type: object + required: + - potency + - berry + properties: + potency: + type: integer + example: 10 + berry: + type: object + require: + - name + - url + properties: + name: + type: string + description: The name of the berry + example: rowap + url: + type: string + format: uri + description: The URL to get more information about the berry + example: https://pokeapi.co/api/v2/berry/64/ readOnly: true contest_type: $ref: '#/components/schemas/ContestTypeSummary' @@ -3178,7 +3227,8 @@ components: gene_modulo: type: integer possible_values: - type: string + type: object + additionalProperties: {} readOnly: true highest_stat: $ref: '#/components/schemas/StatSummary' @@ -3329,7 +3379,22 @@ components: $ref: '#/components/schemas/EggGroupName' readOnly: true pokemon_species: - type: string + type: array + items: + type: object + required: + - potency + - flavor + properties: + name: + type: string + description: Pokemon species name. + example: bulbasaur + url: + type: string + format: uri + description: The URL to get more information about the species + example: https://pokeapi.co/api/v2/pokemon-species/1/ readOnly: true required: - id @@ -3510,7 +3575,8 @@ components: baby_trigger_item: $ref: '#/components/schemas/ItemSummary' chain: - type: string + type: object + additionalProperties: {} readOnly: true required: - baby_trigger_item @@ -3540,7 +3606,8 @@ components: $ref: '#/components/schemas/EvolutionTriggerName' readOnly: true pokemon_species: - type: string + type: object + additionalProperties: {} readOnly: true required: - id @@ -3595,10 +3662,12 @@ components: type: string maxLength: 100 pokemon_species_details: - type: string + type: object + additionalProperties: {} readOnly: true required_for_evolution: - type: string + type: object + additionalProperties: {} readOnly: true required: - id @@ -3775,7 +3844,8 @@ components: $ref: '#/components/schemas/ItemAttributeDescription' readOnly: true items: - type: string + type: object + additionalProperties: {} readOnly: true names: type: array @@ -3887,7 +3957,8 @@ components: fling_effect: $ref: '#/components/schemas/ItemFlingEffectSummary' attributes: - type: string + type: object + additionalProperties: {} readOnly: true category: $ref: '#/components/schemas/ItemCategorySummary' @@ -3912,16 +3983,20 @@ components: $ref: '#/components/schemas/ItemName' readOnly: true held_by_pokemon: - type: string + type: object + additionalProperties: {} readOnly: true sprites: - type: string + type: object + additionalProperties: {} readOnly: true baby_trigger_for: - type: string + type: object + additionalProperties: {} readOnly: true machines: - type: string + type: object + additionalProperties: {} readOnly: true required: - attributes @@ -4163,7 +4238,8 @@ components: maximum: 2147483647 minimum: -2147483648 encounter_method_rates: - type: string + type: object + additionalProperties: {} readOnly: true location: $ref: '#/components/schemas/LocationSummary' @@ -4173,7 +4249,8 @@ components: $ref: '#/components/schemas/LocationAreaName' readOnly: true pokemon_encounters: - type: string + type: object + additionalProperties: {} readOnly: true required: - encounter_method_rates @@ -4368,7 +4445,33 @@ components: effect_chance: type: integer effect_entries: - type: string + type: array + items: + type: object + required: + - effect + - short_effect + - language + properties: + effect: + type: string + example: Inflicts [regular damage]{mechanic:regular-damage}. + short_effect: + type: string + example: Inflicts regular damage with no additional effect. + language: + type: object + required: + - name + - url + properties: + name: + type: string + example: en + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/language/9/ readOnly: true type: $ref: '#/components/schemas/TypeSummary' @@ -4479,7 +4582,87 @@ components: maximum: 2147483647 minimum: -2147483648 contest_combos: - type: string + type: object + properties: + required: + - normal + - super + normal: + type: object + required: + - use_before + - use_after + properties: + use_before: + type: array + nullable: true + items: + type: object + required: + - name + - url + properties: + name: + type: string + example: fire-punch + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/move/7/ + use_after: + type: array + nullable: true + items: + type: object + required: + - name + - url + properties: + name: + type: string + example: ice-punch + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/move/8/ + super: + type: object + required: + - use_before + - use_after + properties: + use_before: + type: array + nullable: true + items: + type: object + required: + - name + - url + properties: + name: + type: string + example: night-slash + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/move/400/ + use_after: + type: array + nullable: true + items: + type: object + required: + - name + - url + properties: + name: + type: string + example: focus-energy + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/move/116/ readOnly: true contest_type: $ref: '#/components/schemas/ContestTypeSummary' @@ -4488,10 +4671,79 @@ components: damage_class: $ref: '#/components/schemas/MoveDamageClassSummary' effect_entries: - type: string + type: array + items: + type: object + required: + - effect + - short_effect + - language + properties: + effect: + type: string + example: Inflicts [regular damage]{mechanic:regular-damage}. + short_effect: + type: string + example: Inflicts regular damage with no additional effect. + language: + type: object + required: + - name + - url + properties: + name: + type: string + example: en + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/language/9/ readOnly: true effect_changes: - type: string + type: array + items: + type: object + required: + - effect_entries + - version_group + properties: + effect_entries: + type: array + items: + type: object + required: + - effect + - language + properties: + effect: + type: string + example: Hits Pokémon under the effects of dig and fly. + language: + type: object + required: + - name + - url + properties: + name: + type: string + example: en + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/language/9/ + version_group: + type: object + required: + - name + - url + properties: + name: + type: string + example: gold-silver + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/version-group/3/ readOnly: true generation: $ref: '#/components/schemas/GenerationSummary' @@ -4510,7 +4762,8 @@ components: $ref: '#/components/schemas/MoveChange' readOnly: true stat_changes: - type: string + type: object + additionalProperties: {} readOnly: true super_contest_effect: $ref: '#/components/schemas/SuperContestEffectSummary' @@ -4519,7 +4772,35 @@ components: type: $ref: '#/components/schemas/TypeSummary' machines: - type: string + type: array + items: + type: object + required: + - machine + - version_group + properties: + machine: + type: object + required: + - url + properties: + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/machine/1/ + version_group: + type: object + required: + - name + - url + properties: + name: + type: string + example: sword-shield + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/version-group/1/ readOnly: true flavor_text_entries: type: array @@ -4527,7 +4808,20 @@ components: $ref: '#/components/schemas/MoveFlavorText' readOnly: true learned_by_pokemon: - type: string + type: array + items: + type: object + required: + - name + - url + properties: + name: + type: string + example: clefairy + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/pokemon/35/ readOnly: true required: - contest_combos @@ -4593,7 +4887,8 @@ components: $ref: '#/components/schemas/MoveLearnMethodDescription' readOnly: true version_groups: - type: string + type: object + additionalProperties: {} readOnly: true required: - descriptions @@ -4705,7 +5000,20 @@ components: type: string maxLength: 100 moves: - type: string + type: array + items: + type: object + required: + - name + - url + properties: + name: + type: string + example: thunder-punch + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/move/9/ readOnly: true names: type: array @@ -4766,7 +5074,20 @@ components: $ref: '#/components/schemas/MoveMetaCategoryDescription' readOnly: true moves: - type: string + type: array + items: + type: object + required: + - name + - url + properties: + name: + type: string + example: sing + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/move/47/ readOnly: true required: - descriptions @@ -4914,7 +5235,8 @@ components: $ref: '#/components/schemas/BerrySummary' readOnly: true pokeathlon_stat_changes: - type: string + type: object + additionalProperties: {} readOnly: true move_battle_style_preferences: type: array @@ -5936,7 +6258,8 @@ components: $ref: '#/components/schemas/PalParkAreaName' readOnly: true pokemon_encounters: - type: string + type: object + additionalProperties: {} readOnly: true required: - id @@ -5977,7 +6300,8 @@ components: type: string maxLength: 100 affecting_natures: - type: string + type: object + additionalProperties: {} readOnly: true names: type: array @@ -6045,12 +6369,14 @@ components: $ref: '#/components/schemas/PokedexName' readOnly: true pokemon_entries: - type: string + type: object + additionalProperties: {} readOnly: true region: $ref: '#/components/schemas/RegionSummary' version_groups: - type: string + type: object + additionalProperties: {} readOnly: true required: - descriptions @@ -6168,10 +6494,12 @@ components: maximum: 2147483647 minimum: -2147483648 abilities: - type: string + type: object + additionalProperties: {} readOnly: true past_abilities: - type: string + type: object + additionalProperties: {} readOnly: true forms: type: array @@ -6184,21 +6512,26 @@ components: $ref: '#/components/schemas/PokemonGameIndex' readOnly: true held_items: - type: string + type: object + additionalProperties: {} readOnly: true location_area_encounters: - type: string + type: object + additionalProperties: {} readOnly: true moves: - type: string + type: object + additionalProperties: {} readOnly: true species: $ref: '#/components/schemas/PokemonSpeciesSummary' sprites: - type: string + type: object + additionalProperties: {} readOnly: true cries: - type: string + type: object + additionalProperties: {} readOnly: true stats: type: array @@ -6206,10 +6539,12 @@ components: $ref: '#/components/schemas/PokemonStat' readOnly: true types: - type: string + type: object + additionalProperties: {} readOnly: true past_types: - type: string + type: object + additionalProperties: {} readOnly: true required: - abilities @@ -6270,18 +6605,22 @@ components: pokemon: $ref: '#/components/schemas/PokemonSummary' sprites: - type: string + type: object + additionalProperties: {} readOnly: true version_group: $ref: '#/components/schemas/VersionGroupSummary' form_names: - type: string + type: object + additionalProperties: {} readOnly: true names: - type: string + type: object + additionalProperties: {} readOnly: true types: - type: string + type: object + additionalProperties: {} readOnly: true required: - form_name @@ -6376,10 +6715,12 @@ components: type: string maxLength: 100 awesome_names: - type: string + type: object + additionalProperties: {} readOnly: true names: - type: string + type: object + additionalProperties: {} readOnly: true pokemon_species: type: array @@ -6472,7 +6813,8 @@ components: $ref: '#/components/schemas/PokemonDexEntry' readOnly: true egg_groups: - type: string + type: object + additionalProperties: {} readOnly: true color: $ref: '#/components/schemas/PokemonColorSummary' @@ -6487,10 +6829,12 @@ components: generation: $ref: '#/components/schemas/GenerationSummary' names: - type: string + type: object + additionalProperties: {} readOnly: true pal_park_encounters: - type: string + type: object + additionalProperties: {} readOnly: true form_descriptions: type: array @@ -6503,10 +6847,12 @@ components: $ref: '#/components/schemas/PokemonSpeciesFlavorText' readOnly: true genera: - type: string + type: object + additionalProperties: {} readOnly: true varieties: - type: string + type: object + additionalProperties: {} readOnly: true required: - color @@ -6611,7 +6957,8 @@ components: $ref: '#/components/schemas/PokedexSummary' readOnly: true version_groups: - type: string + type: object + additionalProperties: {} readOnly: true required: - id @@ -6661,10 +7008,12 @@ components: is_battle_only: type: boolean affecting_moves: - type: string + type: object + additionalProperties: {} readOnly: true affecting_natures: - type: string + type: object + additionalProperties: {} readOnly: true characteristics: type: array @@ -6767,10 +7116,227 @@ components: type: string maxLength: 100 damage_relations: - type: string + type: object + required: + - no_damage_to + - half_damage_to + - double_damage_to + - no_damage_from + - half_damage_from + - double_damage_from + properties: + no_damage_to: + type: array + items: + type: object + required: + - name + - url + properties: + name: + type: string + example: flying + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/type/3/ + half_damage_to: + type: array + items: + type: object + required: + - name + - url + properties: + name: + type: string + example: bug + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/type/7/ + double_damage_to: + type: array + items: + type: object + required: + - name + - url + properties: + name: + type: string + example: poison + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/type/4/ + no_damage_from: + type: array + items: + type: object + required: + - name + - url + properties: + name: + type: string + example: electric + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/type/13/ + half_damage_from: + type: array + items: + type: object + required: + - name + - url + properties: + name: + type: string + example: poison + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/type/4/ + double_damage_from: + type: array + items: + type: object + required: + - name + - url + properties: + name: + type: string + example: water + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/type/11/ readOnly: true past_damage_relations: - type: string + type: array + items: + type: object + required: + - generation + - damage_relations + properties: + generation: + type: object + required: + - name + - url + properties: + name: + type: string + example: generation-v + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/generation/5/ + damage_relations: + type: object + required: + - no_damage_to + - half_damage_to + - double_damage_to + - no_damage_from + - half_damage_from + - double_damage_from + properties: + no_damage_to: + type: array + items: + type: object + required: + - name + - url + properties: + name: + type: string + example: flying + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/type/3/ + half_damage_to: + type: array + items: + type: object + required: + - name + - url + properties: + name: + type: string + example: bug + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/type/7/ + double_damage_to: + type: array + items: + type: object + required: + - name + - url + properties: + name: + type: string + example: poison + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/type/4/ + no_damage_from: + type: array + items: + type: object + required: + - name + - url + properties: + name: + type: string + example: electric + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/type/13/ + half_damage_from: + type: array + items: + type: object + required: + - name + - url + properties: + name: + type: string + example: poison + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/type/4/ + double_damage_from: + type: array + items: + type: object + required: + - name + - url + properties: + name: + type: string + example: water + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/type/11/ readOnly: true game_indices: type: array @@ -6787,7 +7353,31 @@ components: $ref: '#/components/schemas/AbilityName' readOnly: true pokemon: - type: string + type: array + items: + type: object + required: + - potency + - flavor + properties: + slot: + type: integer + example: 1 + pokemon: + type: object + require: + - name + - url + properties: + name: + type: string + description: The name of the pokemon + example: sandshrew + url: + type: string + format: uri + description: The URL to get more information about the pokemon + example: https://pokeapi.co/api/v2/pokemon/27/ readOnly: true moves: type: array @@ -6873,13 +7463,16 @@ components: generation: $ref: '#/components/schemas/GenerationSummary' move_learn_methods: - type: string + type: object + additionalProperties: {} readOnly: true pokedexes: - type: string + type: object + additionalProperties: {} readOnly: true regions: - type: string + type: object + additionalProperties: {} readOnly: true versions: type: array diff --git a/pokemon_v2/serializers.py b/pokemon_v2/serializers.py index cef6f6b13..588654fe1 100644 --- a/pokemon_v2/serializers.py +++ b/pokemon_v2/serializers.py @@ -2,6 +2,8 @@ import json from django.urls import reverse from rest_framework import serializers +from drf_spectacular.types import OpenApiTypes +from drf_spectacular.utils import extend_schema_field, extend_schema, OpenApiParameter, OpenApiExample, extend_schema_serializer # pylint: disable=redefined-builtin @@ -477,6 +479,7 @@ class Meta: "descriptions", ) + @extend_schema_field(OpenApiTypes.OBJECT) def get_values(self, obj): mod = obj.gene_mod_5 values = [] @@ -609,6 +612,7 @@ class Meta: "version_groups", ) + @extend_schema_field(OpenApiTypes.OBJECT) def get_region_version_groups(self, obj): vg_regions = VersionGroupRegion.objects.filter(region=obj) data = VersionGroupRegionSerializer( @@ -676,6 +680,7 @@ class Meta: model = Gender fields = ("id", "name", "pokemon_species_details", "required_for_evolution") + @extend_schema_field(OpenApiTypes.OBJECT) def get_species(self, obj): species_objects = [] @@ -698,6 +703,7 @@ def get_species(self, obj): return details + @extend_schema_field(OpenApiTypes.OBJECT) def get_required(self, obj): evo_objects = PokemonEvolution.objects.filter(gender=obj) species_list = [] @@ -857,6 +863,7 @@ class Meta: "condition_values", ) + @extend_schema_field(OpenApiTypes.OBJECT) def get_encounter_conditions(self, obj): condition_values = EncounterConditionValueMap.objects.filter(encounter=obj) data = EncounterConditionValueMapSerializer( @@ -907,6 +914,7 @@ class Meta: "pokemon_encounters", ) + @extend_schema_field(OpenApiTypes.OBJECT) def get_method_rates(self, obj): # Get encounters related to this area and pull out unique encounter methods encounter_rates = LocationAreaEncounterRate.objects.filter( @@ -948,6 +956,7 @@ def get_method_rates(self, obj): return encounter_rate_list + @extend_schema_field(OpenApiTypes.OBJECT) def get_encounters(self, obj): # get versions for later use version_objects = Version.objects.all() @@ -1119,6 +1128,7 @@ class Meta: "pokemon", ) + @extend_schema_field(OpenApiTypes.OBJECT) def get_ability_pokemon(self, obj): pokemon_ability_objects = PokemonAbility.objects.filter(ability=obj) data = PokemonAbilitySerializer( @@ -1169,6 +1179,7 @@ class Meta: "names", ) + @extend_schema_field(OpenApiTypes.OBJECT) def get_moves_that_affect(self, obj): stat_change_objects = MoveMetaStatChange.objects.filter(stat=obj) stat_changes = MoveMetaStatChangeSerializer( @@ -1185,6 +1196,7 @@ def get_moves_that_affect(self, obj): return changes + @extend_schema_field(OpenApiTypes.OBJECT) def get_natures_that_affect(self, obj): increase_objects = Nature.objects.filter(increased_stat=obj) increases = NatureSummarySerializer( @@ -1279,6 +1291,7 @@ class Meta: model = ItemAttribute fields = ("id", "name", "descriptions", "items", "names") + @extend_schema_field(OpenApiTypes.OBJECT) def get_attribute_items(self, obj): item_map_objects = ItemAttributeMap.objects.filter(item_attribute=obj) items = [] @@ -1395,6 +1408,7 @@ class Meta: "machines", ) + @extend_schema_field(OpenApiTypes.OBJECT) def get_item_machines(self, obj): machine_objects = Machine.objects.filter(item=obj) @@ -1415,10 +1429,12 @@ def get_item_machines(self, obj): return machines + @extend_schema_field(OpenApiTypes.OBJECT) def get_item_sprites(self, obj): sprites_object = ItemSprites.objects.get(item_id=obj) return sprites_object.sprites + @extend_schema_field(OpenApiTypes.OBJECT) def get_item_attributes(self, obj): item_attribute_maps = ItemAttributeMap.objects.filter(item=obj) serializer = ItemAttributeMapSerializer( @@ -1436,6 +1452,7 @@ def get_item_attributes(self, obj): return attributes + @extend_schema_field(OpenApiTypes.OBJECT) def get_held_by_pokemon(self, obj): pokemon_items = PokemonItem.objects.filter(item=obj).order_by("pokemon_id") pokemon_ids = pokemon_items.values("pokemon_id").distinct() @@ -1468,6 +1485,7 @@ def get_held_by_pokemon(self, obj): return pokemon_list + @extend_schema_field(OpenApiTypes.OBJECT) def get_baby_trigger_for(self, obj): try: chain_object = EvolutionChain.objects.get(baby_trigger_item=obj) @@ -1532,6 +1550,7 @@ class Meta: "names", ) + @extend_schema_field(OpenApiTypes.OBJECT) def get_pokeathlon_stats(self, obj): pokeathlon_stat_objects = NaturePokeathlonStat.objects.filter(nature=obj) pokeathlon_stats = NaturePokeathlonStatSerializer( @@ -1587,6 +1606,35 @@ class Meta: model = BerryFlavor fields = ("id", "name", "berries", "contest_type", "names") + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'potency', 'berry' ], + 'properties': { + 'potency': { + 'type': 'integer', + 'example': 10 + }, + 'berry': { + 'type': 'object', + 'require': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'description': 'The name of the berry', + 'example': 'rowap' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'description': 'The URL to get more information about the berry', + 'example': 'https://pokeapi.co/api/v2/berry/64/' + } + } + } + } + }, + }) def get_berries_with_flavor(self, obj): flavor_map_objects = BerryFlavorMap.objects.filter( berry_flavor=obj, potency__gt=0 @@ -1624,6 +1672,35 @@ class Meta: "natural_gift_type", ) + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'potency', 'flavor' ], + 'properties': { + 'potency': { + 'type': 'integer', + 'example': 10 + }, + 'flavor': { + 'type': 'object', + 'require': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'description': 'The name of the flavor', + 'example': 'spicy' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'description': 'The URL to get more information about the flavor', + 'example': 'https://pokeapi.co/api/v2/berry-flavor/1/' + } + } + } + } + }, + }) def get_berry_flavors(self, obj): flavor_map_objects = BerryFlavorMap.objects.filter(berry=obj) flavor_maps = BerryFlavorMapSerializer( @@ -1666,6 +1743,25 @@ class Meta: model = EggGroup fields = ("id", "name", "names", "pokemon_species") + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'potency', 'flavor' ], + 'properties': { + 'name': { + 'type': 'string', + 'description': 'Pokemon species name.', + 'example': 'bulbasaur' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'description': 'The URL to get more information about the species', + 'example': 'https://pokeapi.co/api/v2/pokemon-species/1/' + }, + } + }, + }) def get_species(self, obj): results = PokemonEggGroup.objects.filter(egg_group=obj) data = PokemonEggGroupSerializer(results, many=True, context=self.context).data @@ -1745,6 +1841,7 @@ class Meta: # adds an entry for the given type with the given damage # factor in the given direction to the set of relations + def add_type_entry(self, relations, type, damage_factor, direction="_damage_to"): if damage_factor == 200: relations["double" + direction].append( @@ -1759,6 +1856,126 @@ def add_type_entry(self, relations, type, damage_factor, direction="_damage_to") TypeSummarySerializer(type, context=self.context).data ) + @extend_schema_field(field={'type': 'object', + 'required': [ + 'no_damage_to', + 'half_damage_to', + 'double_damage_to', + 'no_damage_from', + 'half_damage_from', + 'double_damage_from' + ], + 'properties': { + 'no_damage_to': { + 'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'flying' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/type/3/' + } + } + } + }, + 'half_damage_to': { + 'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'bug' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/type/7/' + } + } + } + }, + 'double_damage_to': { + 'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'poison' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/type/4/' + } + } + } + }, + 'no_damage_from': { + 'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'electric' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/type/13/' + } + } + } + }, + 'half_damage_from': { + 'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'poison' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/type/4/' + } + } + } + }, + 'double_damage_from': { + 'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'water' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/type/11/' + } + } + } + } + } + }) def get_type_relationships(self, obj): relations = OrderedDict() relations["no_damage_to"] = [] @@ -1823,6 +2040,150 @@ def remove_type_entry(self, relations, type, direction="_damage_to"): return # returns past type relationships for the given type object + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'generation', 'damage_relations' ], + 'properties': { + 'generation': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'generation-v' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/generation/5/' + } + } + }, + 'damage_relations': { + 'type': 'object', + 'required': [ + 'no_damage_to', + 'half_damage_to', + 'double_damage_to', + 'no_damage_from', + 'half_damage_from', + 'double_damage_from' + ], + 'properties': { + 'no_damage_to': { + 'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'flying' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/type/3/' + } + } + } + }, + 'half_damage_to': { + 'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'bug' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/type/7/' + } + } + } + }, + 'double_damage_to': { + 'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'poison' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/type/4/' + } + } + } + }, + 'no_damage_from': { + 'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'electric' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/type/13/' + } + } + } + }, + 'half_damage_from': { + 'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'poison' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/type/4/' + } + } + } + }, + 'double_damage_from': { + 'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'water' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/type/11/' + } + } + } + } + } + } + } + }, + }) def get_type_past_relationships(self, obj): # collect data from DB damage_type_results = list(TypeEfficacyPast.objects.filter(damage_type=obj)) @@ -1917,6 +2278,35 @@ def type_is_present(self, type, current_gen): gen_introduced = Generation.objects.get(pk=type_obj.generation.id) return gen_introduced.id <= current_gen.id + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'potency', 'flavor' ], + 'properties': { + 'slot': { + 'type': 'integer', + 'example': 1 + }, + 'pokemon': { + 'type': 'object', + 'require': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'description': 'The name of the pokemon', + 'example': 'sandshrew' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'description': 'The URL to get more information about the pokemon', + 'example': 'https://pokeapi.co/api/v2/pokemon/27/' + } + } + } + } + }, + }) def get_type_pokemon(self, obj): poke_type_objects = PokemonType.objects.filter(type=obj) poke_types = PokemonTypeSerializer( @@ -2023,6 +2413,23 @@ class Meta: model = MoveMetaAilment fields = ("id", "name", "moves", "names") + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'thunder-punch' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/move/9/' + } + } + }, + }) def get_ailment_moves(self, obj): move_meta_objects = MoveMeta.objects.filter(move_meta_ailment=obj) moves = [] @@ -2053,6 +2460,23 @@ class Meta: model = MoveMetaCategory fields = ("id", "name", "descriptions", "moves") + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'sing' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/move/47/' + } + } + }, + }) def get_category_moves(self, obj): move_meta_objects = MoveMeta.objects.filter(move_meta_category=obj) moves = [] @@ -2147,6 +2571,37 @@ class Meta: "version_group", ) + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'effect', 'short_effect', 'language' ], + 'properties': { + 'effect': { + 'type': 'string', + 'example': 'Inflicts [regular damage]{mechanic:regular-damage}.' + }, + 'short_effect': { + 'type': 'string', + 'example': 'Inflicts regular damage with no additional effect.' + }, + 'language': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'en' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/language/9/' + } + } + } + }, + }, + }) def get_effects(self, obj): effect_texts = MoveEffectEffectText.objects.filter(move_effect=obj.move_effect) data = MoveEffectEffectTextSerializer( @@ -2244,6 +2699,23 @@ class Meta: "learned_by_pokemon", ) + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'clefairy' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/pokemon/35/' + } + } + }, + }) def get_learned_by_pokemon(self, obj): pokemon_moves = PokemonMove.objects.filter(move_id=obj).order_by("pokemon_id") @@ -2261,6 +2733,40 @@ def get_learned_by_pokemon(self, obj): return pokemon_list + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'machine', 'version_group' ], + 'properties': { + 'machine': { + 'type': 'object', + 'required': [ 'url' ], + 'properties': { + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/machine/1/' + } + } + }, + 'version_group': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'sword-shield' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/version-group/1/' + } + } + } + } + }, + }) def get_move_machines(self, obj): machine_objects = Machine.objects.filter(move=obj) @@ -2281,6 +2787,99 @@ def get_move_machines(self, obj): return machines + @extend_schema_field(field={'type': 'object', + 'properties': { + 'required': [ 'normal', 'super' ], + 'normal': { + 'type': 'object', + 'required': [ 'use_before', 'use_after' ], + 'properties': { + 'use_before': { + 'type': 'array', + 'nullable': True, + 'items': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'fire-punch' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/move/7/' + } + } + } + }, + 'use_after': { + 'type': 'array', + 'nullable': True, + 'items': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'ice-punch' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/move/8/' + } + } + } + } + } + }, + 'super': { + 'type': 'object', + 'required': [ 'use_before', 'use_after' ], + 'properties': { + 'use_before': { + 'type': 'array', + 'nullable': True, + 'items': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'night-slash' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/move/400/' + } + } + } + }, + 'use_after': { + 'type': 'array', + 'nullable': True, + 'items': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'focus-energy' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/move/116/' + } + } + } + } + } + }, + }, + }) def get_combos(self, obj): normal_before_objects = ContestCombo.objects.filter(first_move=obj) normal_before_data = ContestComboSerializer( @@ -2338,6 +2937,37 @@ def get_combos(self, obj): return details + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'effect', 'short_effect', 'language' ], + 'properties': { + 'effect': { + 'type': 'string', + 'example': 'Inflicts [regular damage]{mechanic:regular-damage}.' + }, + 'short_effect': { + 'type': 'string', + 'example': 'Inflicts regular damage with no additional effect.' + }, + 'language': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'en' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/language/9/' + } + } + } + }, + }, + }) def get_effect_text(self, obj): effect_texts = MoveEffectEffectText.objects.filter(move_effect=obj.move_effect) data = MoveEffectEffectTextSerializer( @@ -2352,6 +2982,57 @@ def get_effect_text(self, obj): return data + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'effect_entries', 'version_group' ], + 'properties': { + 'effect_entries': { + 'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'effect', 'language' ], + 'properties': { + 'effect': { + 'type': 'string', + 'example': 'Hits Pokémon under the effects of dig and fly.' + }, + 'language': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'en' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/language/9/' + } + } + } + } + } + }, + 'version_group': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'gold-silver' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/version-group/3/' + } + } + } + } + } + }) def get_effect_change_text(self, obj): effect_changes = MoveEffectChange.objects.filter(move_effect=obj.move_effect) data = MoveEffectChangeSerializer( @@ -2360,6 +3041,7 @@ def get_effect_change_text(self, obj): return data + @extend_schema_field(OpenApiTypes.OBJECT) def get_move_stat_change(self, obj): stat_change_objects = MoveMetaStatChange.objects.filter(move=obj) stat_changes = MoveMetaStatChangeSerializer( @@ -2404,6 +3086,7 @@ class Meta: model = PalParkArea fields = ("id", "name", "names", "pokemon_encounters") + @extend_schema_field(OpenApiTypes.OBJECT) def get_encounters(self, obj): pal_park_objects = PalPark.objects.filter(pal_park_area=obj) parks = PalParkSerializer( @@ -2488,6 +3171,7 @@ class Meta: "types", ) + @extend_schema_field(OpenApiTypes.OBJECT) def get_pokemon_form_names(self, obj): form_results = PokemonFormName.objects.filter( pokemon_form=obj, name__regex=".+" @@ -2503,6 +3187,7 @@ def get_pokemon_form_names(self, obj): return data + @extend_schema_field(OpenApiTypes.OBJECT) def get_pokemon_form_pokemon_names(self, obj): form_results = PokemonFormName.objects.filter( pokemon_form=obj, pokemon_name__regex=".+" @@ -2519,10 +3204,12 @@ def get_pokemon_form_pokemon_names(self, obj): return data + @extend_schema_field(OpenApiTypes.OBJECT) def get_pokemon_form_sprites(self, obj): sprites_object = PokemonFormSprites.objects.get(pokemon_form_id=obj) return sprites_object.sprites + @extend_schema_field(OpenApiTypes.OBJECT) def get_pokemon_form_types(self, obj): form_type_objects = PokemonFormType.objects.filter(pokemon_form=obj) form_types = PokemonFormTypeSerializer( @@ -2606,6 +3293,7 @@ class Meta: model = MoveLearnMethod fields = ("id", "name", "names", "descriptions", "version_groups") + @extend_schema_field(OpenApiTypes.OBJECT) def get_method_version_groups(self, obj): version_group_objects = VersionGroupMoveLearnMethod.objects.filter( move_learn_method=obj @@ -2650,6 +3338,7 @@ class Meta: model = PokemonShape fields = ("id", "name", "awesome_names", "names", "pokemon_species") + @extend_schema_field(OpenApiTypes.OBJECT) def get_shape_names(self, obj): results = PokemonShapeName.objects.filter(pokemon_shape_id=obj) serializer = PokemonShapeNameSerializer( @@ -2662,6 +3351,7 @@ def get_shape_names(self, obj): return data + @extend_schema_field(OpenApiTypes.OBJECT) def get_shape_awesome_names(self, obj): results = PokemonShapeName.objects.filter(pokemon_shape_id=obj) serializer = PokemonShapeNameSerializer( @@ -2755,14 +3445,17 @@ class Meta: "past_types", ) + @extend_schema_field(OpenApiTypes.OBJECT) def get_pokemon_sprites(self, obj): sprites_object = PokemonSprites.objects.get(pokemon_id=obj) return sprites_object.sprites + @extend_schema_field(OpenApiTypes.OBJECT) def get_pokemon_cries(self, obj): cries_object = PokemonCries.objects.get(pokemon_id=obj) return cries_object.cries + @extend_schema_field(OpenApiTypes.OBJECT) def get_pokemon_moves(self, obj): version_objects = VersionGroup.objects.all() version_data = VersionGroupSummarySerializer( @@ -2814,6 +3507,7 @@ def get_pokemon_moves(self, obj): return move_list + @extend_schema_field(OpenApiTypes.OBJECT) def get_pokemon_held_items(self, obj): # Get items related to this pokemon and pull out unique Item IDs pokemon_items = PokemonItem.objects.filter(pokemon_id=obj).order_by("item_id") @@ -2847,6 +3541,7 @@ def get_pokemon_held_items(self, obj): return item_list + @extend_schema_field(OpenApiTypes.OBJECT) def get_pokemon_abilities(self, obj): pokemon_ability_objects = PokemonAbility.objects.filter(pokemon=obj) data = PokemonAbilitySerializer( @@ -2860,6 +3555,7 @@ def get_pokemon_abilities(self, obj): return abilities + @extend_schema_field(OpenApiTypes.OBJECT) def get_past_pokemon_abilities(self, obj): pokemon_past_ability_objects = PokemonAbilityPast.objects.filter(pokemon=obj) pokemon_past_abilities = PokemonAbilityPastSerializer( @@ -2895,6 +3591,7 @@ def get_past_pokemon_abilities(self, obj): return final_data + @extend_schema_field(OpenApiTypes.OBJECT) def get_pokemon_types(self, obj): poke_type_objects = PokemonType.objects.filter(pokemon=obj) poke_types = PokemonTypeSerializer( @@ -2906,6 +3603,7 @@ def get_pokemon_types(self, obj): return poke_types + @extend_schema_field(OpenApiTypes.OBJECT) def get_past_pokemon_types(self, obj): poke_past_type_objects = PokemonTypePast.objects.filter(pokemon=obj) poke_past_types = PokemonTypePastSerializer( @@ -2941,6 +3639,7 @@ def get_past_pokemon_types(self, obj): return final_data + @extend_schema_field(OpenApiTypes.OBJECT) def get_encounters(self, obj): return reverse("pokemon_encounters", kwargs={"pokemon_id": obj.pk}) @@ -2966,6 +3665,7 @@ class Meta: model = EvolutionTrigger fields = ("id", "name", "names", "pokemon_species") + @extend_schema_field(OpenApiTypes.OBJECT) def get_species(self, obj): evo_objects = PokemonEvolution.objects.filter(evolution_trigger=obj) species_list = [] @@ -3073,6 +3773,7 @@ class Meta: "varieties", ) + @extend_schema_field(OpenApiTypes.OBJECT) def get_pokemon_names(self, obj): species_results = PokemonSpeciesName.objects.filter(pokemon_species=obj) species_serializer = PokemonSpeciesNameSerializer( @@ -3086,6 +3787,7 @@ def get_pokemon_names(self, obj): return data + @extend_schema_field(OpenApiTypes.OBJECT) def get_pokemon_genera(self, obj): results = PokemonSpeciesName.objects.filter(pokemon_species=obj) serializer = PokemonSpeciesNameSerializer( @@ -3101,6 +3803,7 @@ def get_pokemon_genera(self, obj): return genera + @extend_schema_field(OpenApiTypes.OBJECT) def get_pokemon_egg_groups(self, obj): results = PokemonEggGroup.objects.filter(pokemon_species=obj) data = PokemonEggGroupSerializer(results, many=True, context=self.context).data @@ -3110,6 +3813,7 @@ def get_pokemon_egg_groups(self, obj): return groups + @extend_schema_field(OpenApiTypes.OBJECT) def get_pokemon_varieties(self, obj): results = Pokemon.objects.filter(pokemon_species=obj) summary_data = PokemonSummarySerializer( @@ -3129,6 +3833,7 @@ def get_pokemon_varieties(self, obj): return varieties + @extend_schema_field(OpenApiTypes.OBJECT) def get_encounters(self, obj): pal_park_objects = PalPark.objects.filter(pokemon_species=obj) parks = PalParkSerializer( @@ -3186,6 +3891,7 @@ class Meta: model = EvolutionChain fields = ("id", "baby_trigger_item", "chain") + @extend_schema_field(OpenApiTypes.OBJECT) def build_chain(self, obj): chain_id = obj.id @@ -3298,6 +4004,7 @@ class Meta: model = PokeathlonStat fields = ("id", "name", "affecting_natures", "names") + @extend_schema_field(OpenApiTypes.OBJECT) def get_natures_that_affect(self, obj): stat_change_objects = NaturePokeathlonStat.objects.filter(pokeathlon_stat=obj) stat_changes = NaturePokeathlonStatSerializer( @@ -3356,6 +4063,7 @@ class Meta: "version_groups", ) + @extend_schema_field(OpenApiTypes.OBJECT) def get_pokedex_entries(self, obj): results = PokemonDexNumber.objects.filter(pokedex=obj).order_by( "pokedex_number" @@ -3370,6 +4078,7 @@ def get_pokedex_entries(self, obj): return data + @extend_schema_field(OpenApiTypes.OBJECT) def get_pokedex_version_groups(self, obj): dex_group_objects = PokedexVersionGroup.objects.filter(pokedex=obj) dex_groups = PokedexVersionGroupSerializer( @@ -3429,6 +4138,7 @@ class Meta: "versions", ) + @extend_schema_field(OpenApiTypes.OBJECT) def get_version_group_regions(self, obj): vg_regions = VersionGroupRegion.objects.filter(version_group=obj) data = VersionGroupRegionSerializer( @@ -3441,6 +4151,7 @@ def get_version_group_regions(self, obj): return regions + @extend_schema_field(OpenApiTypes.OBJECT) def get_learn_methods(self, obj): learn_method_objects = VersionGroupMoveLearnMethod.objects.filter( version_group=obj @@ -3455,6 +4166,7 @@ def get_learn_methods(self, obj): return methods + @extend_schema_field(OpenApiTypes.OBJECT) def get_version_groups_pokedexes(self, obj): dex_group_objects = PokedexVersionGroup.objects.filter(version_group=obj) dex_groups = PokedexVersionGroupSerializer( From 5ee7cdd312eb1cf70a6f7ae5f3aed61d766e52df Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Fri, 1 Mar 2024 03:57:22 -0600 Subject: [PATCH 18/49] docs: update summary --- pokemon_v2/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pokemon_v2/api.py b/pokemon_v2/api.py index 1737680a9..518985e58 100644 --- a/pokemon_v2/api.py +++ b/pokemon_v2/api.py @@ -787,7 +787,7 @@ class SuperContestEffectResource(PokeapiCommonViewset): @extend_schema( description='Types are properties for Pokémon and their moves. Each type has three properties: which types of Pokémon it is super effective against, which types of Pokémon it is not very effective against, and which types of Pokémon it is completely ineffective against.', - summary='List types', + summary='Get types', tags=[ 'pokemon' ], ) @extend_schema_view( From adc66c097bcad9a33288c691467a1cef1a4ad63e Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Sat, 2 Mar 2024 02:51:42 -0600 Subject: [PATCH 19/49] fix: add schema_field definitions --- openapi.yml | 324 +++++++++++++++++++++++++++++++-- pokemon_v2/serializers.py | 365 +++++++++++++++++++++++++++++++++++++- 2 files changed, 665 insertions(+), 24 deletions(-) diff --git a/openapi.yml b/openapi.yml index 5d90c1e36..38cf8b799 100644 --- a/openapi.yml +++ b/openapi.yml @@ -2931,8 +2931,33 @@ components: $ref: '#/components/schemas/AbilityFlavorText' readOnly: true pokemon: - type: object - additionalProperties: {} + type: array + items: + type: object + required: + - is_hidden + - slot + - pokemon + properties: + is_hidden: + type: boolean + example: true + slot: + type: number + example: 3 + pokemon: + type: object + required: + - name + - url + properties: + name: + type: string + example: gloom + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/pokemon/44/ readOnly: true required: - effect_changes @@ -3227,8 +3252,17 @@ components: gene_modulo: type: integer possible_values: - type: object - additionalProperties: {} + type: array + items: + type: number + example: + - 0 + - 5 + - 10 + - 15 + - 20 + - 25 + - 30 readOnly: true highest_stat: $ref: '#/components/schemas/StatSummary' @@ -3662,12 +3696,45 @@ components: type: string maxLength: 100 pokemon_species_details: - type: object - additionalProperties: {} + type: array + items: + type: object + required: + - rate + - pokemon_species + properties: + rate: + type: number + example: 1 + pokemon_species: + type: object + required: + - name + - url + properties: + name: + type: string + example: bulbasaur + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/pokemon-species/1/ readOnly: true required_for_evolution: - type: object - additionalProperties: {} + type: array + items: + type: object + required: + - name + - url + properties: + name: + type: string + example: wormadam + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/pokemon-species/413/ readOnly: true required: - id @@ -4238,8 +4305,50 @@ components: maximum: 2147483647 minimum: -2147483648 encounter_method_rates: - type: object - additionalProperties: {} + type: array + items: + type: object + required: + - encounter_method + - version_details + properties: + encounter_method: + type: object + required: + - name + - url + properties: + name: + type: string + example: old-rod + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/encounter-method/2/ + version_details: + type: array + items: + type: object + required: + - rate + - version + properties: + rate: + type: number + example: 5 + version: + type: object + required: + - name + - url + properties: + name: + type: string + example: platinum + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/version/14/ readOnly: true location: $ref: '#/components/schemas/LocationSummary' @@ -4249,8 +4358,95 @@ components: $ref: '#/components/schemas/LocationAreaName' readOnly: true pokemon_encounters: - type: object - additionalProperties: {} + type: array + items: + type: object + required: + - pokemon + - version_details + properties: + pokemon: + type: object + required: + - name + - url + properties: + name: + type: string + example: tentacool + url: + type: string + format: uri + example: ttps://pokeapi.co/api/v2/pokemon/72/ + version_details: + type: array + items: + type: object + required: + - version + - max_chance + - encounter_details + properties: + version: + type: object + required: + - name + - url + properties: + name: + type: string + example: diamond + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/version/12/ + max_chance: + type: number + example: 60 + encounter_details: + type: object + required: + - min_level + - max_level + - condition_value + - chance + - method + properties: + min_level: + type: number + example: 20 + max_level: + type: number + example: 30 + condition_values: + type: object + required: + - name + - url + properties: + name: + type: string + example: slot2-sapphire + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/encounter-condition-value/10/ + chance: + type: number + example: 60 + method: + type: object + required: + - name + - url + properties: + name: + type: string + example: surf + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/encounter-method/5/ readOnly: true required: - encounter_method_rates @@ -6957,8 +7153,20 @@ components: $ref: '#/components/schemas/PokedexSummary' readOnly: true version_groups: - type: object - additionalProperties: {} + type: array + items: + type: object + required: + - name + - url + properties: + name: + type: string + example: red-blue + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/version-group/1/ readOnly: true required: - id @@ -7009,11 +7217,95 @@ components: type: boolean affecting_moves: type: object - additionalProperties: {} + required: + - decrease + - increase + properties: + increase: + type: array + items: + type: object + required: + - change + - move + properties: + change: + type: number + example: -1 + move: + type: object + required: + - name + - url + properties: + name: + type: string + example: swords-dance + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/move/14/ + decrease: + type: array + items: + type: object + required: + - change + - move + properties: + change: + type: number + example: 5 + move: + type: object + required: + - name + - url + properties: + name: + type: string + example: growl + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/move/45/ readOnly: true affecting_natures: type: object - additionalProperties: {} + required: + - increase + - decrease + properties: + increase: + type: array + items: + type: object + required: + - name + - url + properties: + name: + type: string + example: lonely + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/nature/6/ + decrease: + type: array + items: + type: object + required: + - name + - url + properties: + name: + type: string + example: bold + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/nature/2/ readOnly: true characteristics: type: array diff --git a/pokemon_v2/serializers.py b/pokemon_v2/serializers.py index 588654fe1..33ec11d64 100644 --- a/pokemon_v2/serializers.py +++ b/pokemon_v2/serializers.py @@ -479,7 +479,12 @@ class Meta: "descriptions", ) - @extend_schema_field(OpenApiTypes.OBJECT) + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'number', + }, + 'example': [ 0, 5, 10, 15, 20, 25, 30 ] + }) def get_values(self, obj): mod = obj.gene_mod_5 values = [] @@ -612,7 +617,23 @@ class Meta: "version_groups", ) - @extend_schema_field(OpenApiTypes.OBJECT) + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'red-blue' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/version-group/1/' + } + } + } + }) def get_region_version_groups(self, obj): vg_regions = VersionGroupRegion.objects.filter(region=obj) data = VersionGroupRegionSerializer( @@ -680,7 +701,33 @@ class Meta: model = Gender fields = ("id", "name", "pokemon_species_details", "required_for_evolution") - @extend_schema_field(OpenApiTypes.OBJECT) + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'rate', 'pokemon_species' ], + 'properties': { + 'rate': { + 'type': 'number', + 'example': 1 + }, + 'pokemon_species': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'bulbasaur' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/pokemon-species/1/' + } + } + } + } + } + }) def get_species(self, obj): species_objects = [] @@ -703,7 +750,23 @@ def get_species(self, obj): return details - @extend_schema_field(OpenApiTypes.OBJECT) + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'wormadam' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/pokemon-species/413/' + } + } + } + }) def get_required(self, obj): evo_objects = PokemonEvolution.objects.filter(gender=obj) species_list = [] @@ -863,6 +926,7 @@ class Meta: "condition_values", ) + # no response at the moment @extend_schema_field(OpenApiTypes.OBJECT) def get_encounter_conditions(self, obj): condition_values = EncounterConditionValueMap.objects.filter(encounter=obj) @@ -914,7 +978,57 @@ class Meta: "pokemon_encounters", ) - @extend_schema_field(OpenApiTypes.OBJECT) + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'encounter_method', 'version_details' ], + 'properties': { + 'encounter_method': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'old-rod' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/encounter-method/2/' + } + } + }, + 'version_details': { + 'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'rate', 'version' ], + 'properties': { + 'rate': { + 'type': 'number', + 'example': 5 + }, + 'version': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'platinum' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/version/14/' + } + } + } + } + } + } + } + } + }) def get_method_rates(self, obj): # Get encounters related to this area and pull out unique encounter methods encounter_rates = LocationAreaEncounterRate.objects.filter( @@ -956,7 +1070,111 @@ def get_method_rates(self, obj): return encounter_rate_list - @extend_schema_field(OpenApiTypes.OBJECT) + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'pokemon', 'version_details' ], + 'properties': { + 'pokemon': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'tentacool' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'ttps://pokeapi.co/api/v2/pokemon/72/' + } + } + }, + 'version_details': { + 'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'version', 'max_chance', 'encounter_details' ], + 'properties': { + 'version': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'diamond' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/version/12/' + } + } + }, + 'max_chance': { + 'type': 'number', + 'example': 60 + }, + 'encounter_details': { + 'type': 'object', + 'required': [ + 'min_level', + 'max_level', + 'condition_value', + 'chance', + 'method' + ], + 'properties': { + 'min_level': { + 'type': 'number', + 'example': 20 + }, + 'max_level': { + 'type': 'number', + 'example': 30 + }, + 'condition_values': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'slot2-sapphire' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/encounter-condition-value/10/' + } + } + }, + 'chance': { + 'type': 'number', + 'example': 60 + }, + 'method': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'surf' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/encounter-method/5/' + } + } + } + } + } + } + } + } + } + } + }) def get_encounters(self, obj): # get versions for later use version_objects = Version.objects.all() @@ -1128,7 +1346,37 @@ class Meta: "pokemon", ) - @extend_schema_field(OpenApiTypes.OBJECT) + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'is_hidden', 'slot', 'pokemon' ], + 'properties': { + 'is_hidden': { + 'type': 'boolean', + 'example': True + }, + 'slot': { + 'type': 'number', + 'example': 3 + }, + 'pokemon': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'gloom' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/pokemon/44/' + } + } + } + } + } + }) def get_ability_pokemon(self, obj): pokemon_ability_objects = PokemonAbility.objects.filter(ability=obj) data = PokemonAbilitySerializer( @@ -1179,6 +1427,67 @@ class Meta: "names", ) + @extend_schema_field(field={'type': 'object', + 'required': [ 'decrease', 'increase' ], + 'properties': { + 'increase': { + 'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'change', 'move' ], + 'properties': { + 'change': { + 'type': 'number', + 'example': -1 + }, + 'move': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'swords-dance' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/move/14/' + } + } + } + } + } + }, + 'decrease': { + 'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'change', 'move' ], + 'properties': { + 'change': { + 'type': 'number', + 'example': 5 + }, + 'move': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'growl' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/move/45/' + } + } + } + } + } + } + } + }) @extend_schema_field(OpenApiTypes.OBJECT) def get_moves_that_affect(self, obj): stat_change_objects = MoveMetaStatChange.objects.filter(stat=obj) @@ -1196,7 +1505,47 @@ def get_moves_that_affect(self, obj): return changes - @extend_schema_field(OpenApiTypes.OBJECT) + @extend_schema_field(field={'type': 'object', + 'required': [ 'increase', 'decrease' ], + 'properties': { + 'increase': { + 'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'lonely' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/nature/6/' + } + } + } + }, + 'decrease': { + 'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'bold' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/nature/2/' + } + } + } + }, + } + }) def get_natures_that_affect(self, obj): increase_objects = Nature.objects.filter(increased_stat=obj) increases = NatureSummarySerializer( From ddeaeebeb89ac73dcddf16ceb3fc5e249819436d Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Sun, 3 Mar 2024 00:40:40 -0600 Subject: [PATCH 20/49] fix: add `item` schema_field definitions --- openapi.yml | 120 +++++++++++++++++++++++++++++--- pokemon_v2/serializers.py | 140 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 243 insertions(+), 17 deletions(-) diff --git a/openapi.yml b/openapi.yml index 38cf8b799..e5419cbd3 100644 --- a/openapi.yml +++ b/openapi.yml @@ -3911,8 +3911,20 @@ components: $ref: '#/components/schemas/ItemAttributeDescription' readOnly: true items: - type: object - additionalProperties: {} + type: array + items: + type: object + required: + - name + - url + properties: + name: + type: string + example: master-ball + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/item/1/ readOnly: true names: type: array @@ -4024,8 +4036,20 @@ components: fling_effect: $ref: '#/components/schemas/ItemFlingEffectSummary' attributes: - type: object - additionalProperties: {} + type: array + items: + type: object + required: + - name + - url + properties: + name: + type: string + example: countable + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/item-attribute/1/ readOnly: true category: $ref: '#/components/schemas/ItemCategorySummary' @@ -4050,20 +4074,96 @@ components: $ref: '#/components/schemas/ItemName' readOnly: true held_by_pokemon: - type: object - additionalProperties: {} + type: array + items: + type: object + required: + - pokemon + - version-details + properties: + pokemon: + type: object + required: + - name + - url + properties: + name: + type: string + example: farfetchd + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/pokemon/83/ + version-details: + type: array + items: + type: object + required: + - rarity + - version + properties: + rarity: + type: number + example: 5 + version: + type: object + required: + - name + - url + properties: + name: + type: string + example: ruby + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/version/7/ readOnly: true sprites: type: object - additionalProperties: {} + required: + - default + properties: + default: + type: string + format: uri + example: https://pokeapi.co/media/sprites/items/master-ball.png readOnly: true baby_trigger_for: type: object - additionalProperties: {} + required: + - url + properties: + url: + type: string + format: uri + example: '"https://pokeapi.co/api/v2/evolution-chain/51/' readOnly: true machines: - type: object - additionalProperties: {} + type: array + items: + type: object + required: + - machine + - version_group + properties: + machine: + type: string + format: uri + example: https://pokeapi.co/api/v2/machine/1/ + version_group: + type: object + required: + - name + - url + properties: + name: + type: string + example: sword-shield + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/version-group/20/ readOnly: true required: - attributes diff --git a/pokemon_v2/serializers.py b/pokemon_v2/serializers.py index 33ec11d64..eb6829919 100644 --- a/pokemon_v2/serializers.py +++ b/pokemon_v2/serializers.py @@ -1488,7 +1488,6 @@ class Meta: } } }) - @extend_schema_field(OpenApiTypes.OBJECT) def get_moves_that_affect(self, obj): stat_change_objects = MoveMetaStatChange.objects.filter(stat=obj) stat_changes = MoveMetaStatChangeSerializer( @@ -1640,7 +1639,23 @@ class Meta: model = ItemAttribute fields = ("id", "name", "descriptions", "items", "names") - @extend_schema_field(OpenApiTypes.OBJECT) + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'master-ball' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/item/1/' + } + } + } + }) def get_attribute_items(self, obj): item_map_objects = ItemAttributeMap.objects.filter(item_attribute=obj) items = [] @@ -1757,7 +1772,34 @@ class Meta: "machines", ) - @extend_schema_field(OpenApiTypes.OBJECT) + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'machine', 'version_group' ], + 'properties': { + 'machine': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/machine/1/' + }, + 'version_group': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'sword-shield' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/version-group/20/' + } + } + } + } + } + }) def get_item_machines(self, obj): machine_objects = Machine.objects.filter(item=obj) @@ -1778,12 +1820,37 @@ def get_item_machines(self, obj): return machines - @extend_schema_field(OpenApiTypes.OBJECT) + @extend_schema_field(field={'type': 'object', + 'required': [ 'default' ], + 'properties': { + 'default': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/media/sprites/items/master-ball.png' + } + } + }) def get_item_sprites(self, obj): sprites_object = ItemSprites.objects.get(item_id=obj) return sprites_object.sprites - @extend_schema_field(OpenApiTypes.OBJECT) + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'countable' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/item-attribute/1/' + } + } + } + }) def get_item_attributes(self, obj): item_attribute_maps = ItemAttributeMap.objects.filter(item=obj) serializer = ItemAttributeMapSerializer( @@ -1801,7 +1868,57 @@ def get_item_attributes(self, obj): return attributes - @extend_schema_field(OpenApiTypes.OBJECT) + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'pokemon', 'version-details' ], + 'properties': { + 'pokemon': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'farfetchd' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/pokemon/83/' + } + } + }, + 'version-details': { + 'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'rarity', 'version' ], + 'properties': { + 'rarity': { + 'type': 'number', + 'example': 5 + }, + 'version': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'ruby' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/version/7/' + } + } + } + } + } + } + } + } + }) def get_held_by_pokemon(self, obj): pokemon_items = PokemonItem.objects.filter(item=obj).order_by("pokemon_id") pokemon_ids = pokemon_items.values("pokemon_id").distinct() @@ -1834,7 +1951,16 @@ def get_held_by_pokemon(self, obj): return pokemon_list - @extend_schema_field(OpenApiTypes.OBJECT) + @extend_schema_field(field={'type': 'object', + 'required': [ 'url' ], + 'properties': { + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': '"https://pokeapi.co/api/v2/evolution-chain/51/' + } + } + }) def get_baby_trigger_for(self, obj): try: chain_object = EvolutionChain.objects.get(baby_trigger_item=obj) From 3c9d27bf4671c118656d7c297f7029666c884dbd Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Sun, 3 Mar 2024 01:02:00 -0600 Subject: [PATCH 21/49] conf(drf-spectacular): set `COMPONENT_SPLIT_REQUEST` --- config/settings.py | 1 + 1 file changed, 1 insertion(+) diff --git a/config/settings.py b/config/settings.py index ce9b8382f..00c7d392e 100755 --- a/config/settings.py +++ b/config/settings.py @@ -147,5 +147,6 @@ 'VERSION': '2.7.0', 'SERVE_INCLUDE_SCHEMA': False, 'OAS_VERSION': '3.1.0', + 'COMPONENT_SPLIT_REQUEST': True } From 928507938a9c05836d81e08d509b40631ebf5c12 Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Sun, 3 Mar 2024 01:03:33 -0600 Subject: [PATCH 22/49] fix: add `nature` schema_field definitions --- openapi.yml | 25 +++++++++++++++++++++++-- pokemon_v2/serializers.py | 28 +++++++++++++++++++++++++++- 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/openapi.yml b/openapi.yml index e5419cbd3..e0c65c02c 100644 --- a/openapi.yml +++ b/openapi.yml @@ -5531,8 +5531,29 @@ components: $ref: '#/components/schemas/BerrySummary' readOnly: true pokeathlon_stat_changes: - type: object - additionalProperties: {} + type: array + items: + type: object + required: + - max_change + - pokeathlon_stat + properties: + max_change: + type: number + example: 1 + pokeathlon_stat: + type: object + required: + - name + - url + properties: + name: + type: string + example: power + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/pokeathlon-stat/2/ readOnly: true move_battle_style_preferences: type: array diff --git a/pokemon_v2/serializers.py b/pokemon_v2/serializers.py index eb6829919..23da1d337 100644 --- a/pokemon_v2/serializers.py +++ b/pokemon_v2/serializers.py @@ -2025,7 +2025,33 @@ class Meta: "names", ) - @extend_schema_field(OpenApiTypes.OBJECT) + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'max_change', 'pokeathlon_stat' ], + 'properties': { + 'max_change': { + 'type': 'number', + 'example': 1 + }, + 'pokeathlon_stat': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'power' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/pokeathlon-stat/2/' + } + } + } + } + } + }) def get_pokeathlon_stats(self, obj): pokeathlon_stat_objects = NaturePokeathlonStat.objects.filter(nature=obj) pokeathlon_stats = NaturePokeathlonStatSerializer( From e7ea8b2e8ccd55c9bb192e7ff31874e1aebbdc4d Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Sun, 3 Mar 2024 01:27:45 -0600 Subject: [PATCH 23/49] fix: add `move` schema_field definitions --- pokemon_v2/serializers.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/pokemon_v2/serializers.py b/pokemon_v2/serializers.py index 23da1d337..6089b4216 100644 --- a/pokemon_v2/serializers.py +++ b/pokemon_v2/serializers.py @@ -3542,7 +3542,33 @@ def get_effect_change_text(self, obj): return data - @extend_schema_field(OpenApiTypes.OBJECT) + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'change', 'stat' ], + 'properties': { + 'change': { + 'type': 'number', + 'example': 2 + }, + 'stat': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'attack' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/stat/1/' + } + } + } + } + } + }) def get_move_stat_change(self, obj): stat_change_objects = MoveMetaStatChange.objects.filter(move=obj) stat_changes = MoveMetaStatChangeSerializer( From ef97bc6a456e03945a0d27982e18f6d8699a6a4e Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Sun, 3 Mar 2024 01:45:46 -0600 Subject: [PATCH 24/49] fix: add `pal-park-area` schema_field definitions --- openapi.yml | 54 ++++++++++++++++++++++++++++++++++++--- pokemon_v2/serializers.py | 32 ++++++++++++++++++++++- 2 files changed, 81 insertions(+), 5 deletions(-) diff --git a/openapi.yml b/openapi.yml index e0c65c02c..30a443615 100644 --- a/openapi.yml +++ b/openapi.yml @@ -5058,8 +5058,29 @@ components: $ref: '#/components/schemas/MoveChange' readOnly: true stat_changes: - type: object - additionalProperties: {} + type: array + items: + type: object + required: + - change + - stat + properties: + change: + type: number + example: 2 + stat: + type: object + required: + - name + - url + properties: + name: + type: string + example: attack + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/stat/1/ readOnly: true super_contest_effect: $ref: '#/components/schemas/SuperContestEffectSummary' @@ -6575,8 +6596,33 @@ components: $ref: '#/components/schemas/PalParkAreaName' readOnly: true pokemon_encounters: - type: object - additionalProperties: {} + type: array + items: + type: object + required: + - base_score + - pokemon-species + - rate + properties: + base_score: + type: number + example: 50 + pokemon-species: + type: object + required: + - name + - url + properties: + name: + type: string + example: bulbasaur + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/pokemon-species/1/ + rate: + type: number + example: 30 readOnly: true required: - id diff --git a/pokemon_v2/serializers.py b/pokemon_v2/serializers.py index 6089b4216..33be60f42 100644 --- a/pokemon_v2/serializers.py +++ b/pokemon_v2/serializers.py @@ -3613,7 +3613,37 @@ class Meta: model = PalParkArea fields = ("id", "name", "names", "pokemon_encounters") - @extend_schema_field(OpenApiTypes.OBJECT) + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'base_score', 'pokemon-species', 'rate' ], + 'properties': { + 'base_score': { + 'type': 'number', + 'example': 50 + }, + 'pokemon-species': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'bulbasaur' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/pokemon-species/1/' + } + } + }, + 'rate': { + 'type': 'number', + 'example': 30 + }, + } + } + }) def get_encounters(self, obj): pal_park_objects = PalPark.objects.filter(pal_park_area=obj) parks = PalParkSerializer( From 3bb60381f0f44a2ac3464255db156bc78a8a5c1a Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Sun, 3 Mar 2024 14:37:49 -0600 Subject: [PATCH 25/49] fix: add `pokemon-form` schema_field definitions --- openapi.yml | 95 +++++++++++++++++++++++++++++--- pokemon_v2/serializers.py | 110 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 194 insertions(+), 11 deletions(-) diff --git a/openapi.yml b/openapi.yml index 30a443615..ebc0cbb11 100644 --- a/openapi.yml +++ b/openapi.yml @@ -6969,21 +6969,102 @@ components: $ref: '#/components/schemas/PokemonSummary' sprites: type: object - additionalProperties: {} + properties: + default: + type: string + format: uri + example: https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/412.png + additionalProperties: + type: string + format: uri + nullable: true + example: https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/412.png + example: + back_default: https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/412.png + back_female: null + back_shiny: https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/412.png + back_shiny_female: null + front_default: https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/412.png + front_female: null + front_shiny: https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/shiny/412.png + front_shiny_female: null readOnly: true version_group: $ref: '#/components/schemas/VersionGroupSummary' form_names: - type: object - additionalProperties: {} + type: array + items: + type: object + required: + - language + - name + properties: + language: + type: object + required: + - name + - url + properties: + name: + type: string + example: en + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/language/9/ + name: + type: string + example: Plant Cloak readOnly: true names: - type: object - additionalProperties: {} + type: array + items: + type: object + required: + - language + - name + properties: + language: + type: object + required: + - name + - url + properties: + name: + type: string + example: en + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/language/9/ + name: + type: string + example: Plant Cloak readOnly: true types: - type: object - additionalProperties: {} + type: array + items: + type: object + required: + - slot + - type + properties: + slot: + type: number + example: 1 + type: + type: object + required: + - name + - url + properties: + name: + type: string + example: bug + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/type/7/ readOnly: true required: - form_name diff --git a/pokemon_v2/serializers.py b/pokemon_v2/serializers.py index 33be60f42..5f1e8d58b 100644 --- a/pokemon_v2/serializers.py +++ b/pokemon_v2/serializers.py @@ -3728,7 +3728,33 @@ class Meta: "types", ) - @extend_schema_field(OpenApiTypes.OBJECT) + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'language', 'name' ], + 'properties': { + 'language': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'en' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/language/9/' + } + } + }, + 'name': { + 'type': 'string', + 'example': 'Plant Cloak' + } + } + } + }) def get_pokemon_form_names(self, obj): form_results = PokemonFormName.objects.filter( pokemon_form=obj, name__regex=".+" @@ -3744,7 +3770,33 @@ def get_pokemon_form_names(self, obj): return data - @extend_schema_field(OpenApiTypes.OBJECT) + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'language', 'name' ], + 'properties': { + 'language': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'en' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/language/9/' + } + } + }, + 'name': { + 'type': 'string', + 'example': 'Plant Cloak' + } + } + } + }) def get_pokemon_form_pokemon_names(self, obj): form_results = PokemonFormName.objects.filter( pokemon_form=obj, pokemon_name__regex=".+" @@ -3761,12 +3813,62 @@ def get_pokemon_form_pokemon_names(self, obj): return data - @extend_schema_field(OpenApiTypes.OBJECT) + @extend_schema_field(field={'type': 'object', + 'properties': { + 'default': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/412.png', + } + }, + 'additionalProperties': { # Stoplight Elements doesn't render this well + 'type': 'string', + 'format': 'uri', + 'nullable': True, + 'example': 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/412.png' + }, + 'example': { + 'back_default': 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/412.png', + 'back_female': None, + 'back_shiny': 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/412.png', + 'back_shiny_female': None, + 'front_default': 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/412.png', + 'front_female': None, + 'front_shiny': 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/shiny/412.png', + 'front_shiny_female': None + } + }) def get_pokemon_form_sprites(self, obj): sprites_object = PokemonFormSprites.objects.get(pokemon_form_id=obj) return sprites_object.sprites - @extend_schema_field(OpenApiTypes.OBJECT) + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'slot', 'type' ], + 'properties': { + 'slot': { + 'type': 'number', + 'example': 1 + }, + 'type': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'bug' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/type/7/' + } + } + }, + } + } + }) def get_pokemon_form_types(self, obj): form_type_objects = PokemonFormType.objects.filter(pokemon_form=obj) form_types = PokemonFormTypeSerializer( From fe9c1fa98d6edb566ffc76eb283a6ea197e83f7d Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Sun, 3 Mar 2024 14:46:20 -0600 Subject: [PATCH 26/49] fix: add `move_learn_method` schema_field definitions --- openapi.yml | 16 ++++++++++++++-- pokemon_v2/serializers.py | 23 ++++++++++++++++++++++- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/openapi.yml b/openapi.yml index ebc0cbb11..dc0df517c 100644 --- a/openapi.yml +++ b/openapi.yml @@ -5204,8 +5204,20 @@ components: $ref: '#/components/schemas/MoveLearnMethodDescription' readOnly: true version_groups: - type: object - additionalProperties: {} + type: array + items: + type: object + required: + - name + - url + properties: + name: + type: string + example: red-blue + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/version-group/1/ readOnly: true required: - descriptions diff --git a/pokemon_v2/serializers.py b/pokemon_v2/serializers.py index 5f1e8d58b..edc1fff7e 100644 --- a/pokemon_v2/serializers.py +++ b/pokemon_v2/serializers.py @@ -3952,7 +3952,28 @@ class Meta: model = MoveLearnMethod fields = ("id", "name", "names", "descriptions", "version_groups") - @extend_schema_field(OpenApiTypes.OBJECT) + # "version_groups": [ + # { + # "name": "red-blue", + # "url": "https://pokeapi.co/api/v2/version-group/1/" + # }, + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'red-blue' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/version-group/1/' + } + } + } + }) def get_method_version_groups(self, obj): version_group_objects = VersionGroupMoveLearnMethod.objects.filter( move_learn_method=obj From 38f67d047305663eb91f1607858aee712a7a3c28 Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Sun, 3 Mar 2024 14:58:22 -0600 Subject: [PATCH 27/49] fix: add `pokemon_shape` schema_field definitions --- openapi.yml | 41 +++++++++++++++++++++++--- pokemon_v2/serializers.py | 62 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 97 insertions(+), 6 deletions(-) diff --git a/openapi.yml b/openapi.yml index dc0df517c..b0a6b4c81 100644 --- a/openapi.yml +++ b/openapi.yml @@ -7171,12 +7171,45 @@ components: type: string maxLength: 100 awesome_names: - type: object - additionalProperties: {} + type: array + items: + type: object + required: + - awesome_name + - language + properties: + awesome_name: + type: string + example: Pomaceous + language: + type: object + required: + - name + - url + properties: + name: + type: string + example: en + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/language/9/ readOnly: true names: - type: object - additionalProperties: {} + type: array + items: + type: object + required: + - url + - name + properties: + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/language/9/ + name: + type: string + example: Ball readOnly: true pokemon_species: type: array diff --git a/pokemon_v2/serializers.py b/pokemon_v2/serializers.py index edc1fff7e..596a6827f 100644 --- a/pokemon_v2/serializers.py +++ b/pokemon_v2/serializers.py @@ -4018,7 +4018,23 @@ class Meta: model = PokemonShape fields = ("id", "name", "awesome_names", "names", "pokemon_species") - @extend_schema_field(OpenApiTypes.OBJECT) + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'url', 'name' ], + 'properties': { + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/language/9/' + }, + 'name': { + 'type': 'string', + 'example': 'Ball' + } + } + } + }) def get_shape_names(self, obj): results = PokemonShapeName.objects.filter(pokemon_shape_id=obj) serializer = PokemonShapeNameSerializer( @@ -4031,7 +4047,49 @@ def get_shape_names(self, obj): return data - @extend_schema_field(OpenApiTypes.OBJECT) + # "awesome_names": [ + # { + # "awesome_name": "Pomacé", + # "language": { + # "name": "fr", + # "url": "https://pokeapi.co/api/v2/language/5/" + # } + # }, + # { + # "awesome_name": "Pomaceous", + # "language": { + # "name": "en", + # "url": "https://pokeapi.co/api/v2/language/9/" + # } + # } + # ], + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'awesome_name', 'language' ], + 'properties': { + 'awesome_name': { + 'type': 'string', + 'example': 'Pomaceous' + }, + 'language': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'en' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/language/9/' + } + } + } + } + } + }) def get_shape_awesome_names(self, obj): results = PokemonShapeName.objects.filter(pokemon_shape_id=obj) serializer = PokemonShapeNameSerializer( From 029f663d2f92bc3b02f2d81d2d6de779dbb8dda5 Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Sun, 3 Mar 2024 20:01:04 -0600 Subject: [PATCH 28/49] fix: add `pokemon` schema_field definitions --- openapi.yml | 289 ++++++++++++++++- pokemon_v2/serializers.py | 659 +++++++++++++++++++++++++++++++++++++- 2 files changed, 924 insertions(+), 24 deletions(-) diff --git a/openapi.yml b/openapi.yml index b0a6b4c81..2f8d23f7f 100644 --- a/openapi.yml +++ b/openapi.yml @@ -6869,12 +6869,83 @@ components: maximum: 2147483647 minimum: -2147483648 abilities: - type: object - additionalProperties: {} + type: array + items: + type: object + required: + - ability + - is_hidden + - slot + properties: + ability: + type: object + required: + - name + - url + properties: + name: + type: string + example: sand-veil + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/ability/8/ + is_hidden: + type: boolean + example: false + slot: + type: number + example: 1 readOnly: true past_abilities: - type: object - additionalProperties: {} + type: array + items: + type: object + required: + - abilities + - generation + properties: + abilities: + type: array + items: + type: object + required: + - ability + - is_hidden + - slot + properties: + ability: + type: object + required: + - name + - url + properties: + name: + type: string + example: levitate + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/ability/26/ + is_hidden: + type: boolean + example: false + slot: + type: number + example: 1 + generation: + type: object + required: + - name + - url + properties: + name: + type: string + example: generation-vi + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/generation/6/ readOnly: true forms: type: array @@ -6888,25 +6959,150 @@ components: readOnly: true held_items: type: object - additionalProperties: {} + required: + - item + - version_details + properties: + item: + type: object + required: + - name + - url + properties: + name: + type: string + example: soft-sand + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/item/214/ + version_details: + type: array + items: + type: object + required: + - rarity + - version + properties: + rarity: + type: number + example: 5 + version: + type: object + required: + - name + - url + properties: + name: + type: string + example: diamond + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/version/12/ readOnly: true location_area_encounters: - type: object - additionalProperties: {} + type: string + example: https://pokeapi.co/api/v2/pokemon/1/encounters readOnly: true moves: - type: object - additionalProperties: {} + type: array + items: + type: object + required: + - move + - version_group_details + properties: + move: + type: object + required: + - name + - url + properties: + name: + type: string + example: scratch + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/move/10/ + version_group_details: + type: array + items: + type: object + required: + - level_learned_at + - move_learn_method + - version_group + properties: + level_learned_at: + type: number + example: 1 + move_learn_method: + type: object + required: + - name + - url + properties: + name: + type: string + example: level-up + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/move-learn-method/1/ + version_group: + type: object + required: + - name + - url + properties: + name: + type: string + example: red-blue + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/version-group/1/ readOnly: true species: $ref: '#/components/schemas/PokemonSpeciesSummary' sprites: type: object - additionalProperties: {} + properties: + front_default: + type: string + format: uri + exmaple: https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/1.png + additionalProperties: + type: string + format: uri + nullable: true + example: https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/1.png + example: + back_default: https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/1.png + back_female: null + back_shiny: https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/1.png + back_shiny_female: null + front_default: https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/1.png + front_female: null + front_shiny: https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/shiny/1.png + front_shiny_female: null readOnly: true cries: type: object - additionalProperties: {} + required: + - latest + - legacy + properties: + latest: + type: string + format: uri + example: https://raw.githubusercontent.com/PokeAPI/cries/main/cries/pokemon/latest/50.ogg + legacy: + type: string + format: uri + example: https://raw.githubusercontent.com/PokeAPI/cries/main/cries/pokemon/legacy/50.ogg readOnly: true stats: type: array @@ -6914,12 +7110,75 @@ components: $ref: '#/components/schemas/PokemonStat' readOnly: true types: - type: object - additionalProperties: {} + type: array + items: + type: object + required: + - slot + - type + properties: + slot: + type: number + example: 1 + type: + type: object + required: + - name + - url + properties: + name: + type: string + example: ghost + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/type/8/ readOnly: true past_types: - type: object - additionalProperties: {} + type: array + items: + type: object + required: + - generation + - types + properties: + generation: + type: object + required: + - name + - url + properties: + name: + type: string + example: generation-v + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/generation/5/ + types: + type: array + items: + type: object + required: + - slot + - type + properties: + slot: + type: number + example: 1 + type: + type: object + required: + - name + - url + properties: + name: + type: string + example: normal + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/type/1/ readOnly: true required: - abilities diff --git a/pokemon_v2/serializers.py b/pokemon_v2/serializers.py index 596a6827f..edfcce0a1 100644 --- a/pokemon_v2/serializers.py +++ b/pokemon_v2/serializers.py @@ -4183,17 +4183,387 @@ class Meta: "past_types", ) - @extend_schema_field(OpenApiTypes.OBJECT) + @extend_schema_field(field={'type': 'object', + 'properties': { + 'front_default': { + 'type': 'string', + 'format': 'uri', + 'exmaple': 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/1.png', + } + }, + 'additionalProperties': { # Stoplight Elements doesn't render this well + 'type': 'string', + 'format': 'uri', + 'nullable': True, + 'example': 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/1.png' + }, + 'example': { + 'back_default': 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/1.png', + 'back_female': None, + 'back_shiny': 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/1.png', + 'back_shiny_female': None, + 'front_default': 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/1.png', + 'front_female': None, + 'front_shiny': 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/shiny/1.png', + 'front_shiny_female': None, + } + }) def get_pokemon_sprites(self, obj): sprites_object = PokemonSprites.objects.get(pokemon_id=obj) return sprites_object.sprites - @extend_schema_field(OpenApiTypes.OBJECT) + @extend_schema_field(field={'type': 'object', + 'required': [ 'latest', 'legacy' ], + 'properties': { + 'latest': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://raw.githubusercontent.com/PokeAPI/cries/main/cries/pokemon/latest/50.ogg' + }, + 'legacy': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://raw.githubusercontent.com/PokeAPI/cries/main/cries/pokemon/legacy/50.ogg' + } + } + }) def get_pokemon_cries(self, obj): cries_object = PokemonCries.objects.get(pokemon_id=obj) return cries_object.cries - @extend_schema_field(OpenApiTypes.OBJECT) + # { + # "move": { + # "name": "scratch", + # "url": "https://pokeapi.co/api/v2/move/10/" + # }, + # "version_group_details": [ + # { + # "level_learned_at": 1, + # "move_learn_method": { + # "name": "level-up", + # "url": "https://pokeapi.co/api/v2/move-learn-method/1/" + # }, + # "version_group": { + # "name": "red-blue", + # "url": "https://pokeapi.co/api/v2/version-group/1/" + # } + # }, + # { + # "level_learned_at": 1, + # "move_learn_method": { + # "name": "level-up", + # "url": "https://pokeapi.co/api/v2/move-learn-method/1/" + # }, + # "version_group": { + # "name": "yellow", + # "url": "https://pokeapi.co/api/v2/version-group/2/" + # } + # }, + # { + # "level_learned_at": 1, + # "move_learn_method": { + # "name": "level-up", + # "url": "https://pokeapi.co/api/v2/move-learn-method/1/" + # }, + # "version_group": { + # "name": "gold-silver", + # "url": "https://pokeapi.co/api/v2/version-group/3/" + # } + # }, + # { + # "level_learned_at": 1, + # "move_learn_method": { + # "name": "level-up", + # "url": "https://pokeapi.co/api/v2/move-learn-method/1/" + # }, + # "version_group": { + # "name": "crystal", + # "url": "https://pokeapi.co/api/v2/version-group/4/" + # } + # }, + # { + # "level_learned_at": 1, + # "move_learn_method": { + # "name": "level-up", + # "url": "https://pokeapi.co/api/v2/move-learn-method/1/" + # }, + # "version_group": { + # "name": "ruby-sapphire", + # "url": "https://pokeapi.co/api/v2/version-group/5/" + # } + # }, + # { + # "level_learned_at": 1, + # "move_learn_method": { + # "name": "level-up", + # "url": "https://pokeapi.co/api/v2/move-learn-method/1/" + # }, + # "version_group": { + # "name": "emerald", + # "url": "https://pokeapi.co/api/v2/version-group/6/" + # } + # }, + # { + # "level_learned_at": 1, + # "move_learn_method": { + # "name": "level-up", + # "url": "https://pokeapi.co/api/v2/move-learn-method/1/" + # }, + # "version_group": { + # "name": "firered-leafgreen", + # "url": "https://pokeapi.co/api/v2/version-group/7/" + # } + # }, + # { + # "level_learned_at": 1, + # "move_learn_method": { + # "name": "level-up", + # "url": "https://pokeapi.co/api/v2/move-learn-method/1/" + # }, + # "version_group": { + # "name": "diamond-pearl", + # "url": "https://pokeapi.co/api/v2/version-group/8/" + # } + # }, + # { + # "level_learned_at": 1, + # "move_learn_method": { + # "name": "level-up", + # "url": "https://pokeapi.co/api/v2/move-learn-method/1/" + # }, + # "version_group": { + # "name": "platinum", + # "url": "https://pokeapi.co/api/v2/version-group/9/" + # } + # }, + # { + # "level_learned_at": 1, + # "move_learn_method": { + # "name": "level-up", + # "url": "https://pokeapi.co/api/v2/move-learn-method/1/" + # }, + # "version_group": { + # "name": "heartgold-soulsilver", + # "url": "https://pokeapi.co/api/v2/version-group/10/" + # } + # }, + # { + # "level_learned_at": 1, + # "move_learn_method": { + # "name": "level-up", + # "url": "https://pokeapi.co/api/v2/move-learn-method/1/" + # }, + # "version_group": { + # "name": "black-white", + # "url": "https://pokeapi.co/api/v2/version-group/11/" + # } + # }, + # { + # "level_learned_at": 1, + # "move_learn_method": { + # "name": "level-up", + # "url": "https://pokeapi.co/api/v2/move-learn-method/1/" + # }, + # "version_group": { + # "name": "colosseum", + # "url": "https://pokeapi.co/api/v2/version-group/12/" + # } + # }, + # { + # "level_learned_at": 1, + # "move_learn_method": { + # "name": "level-up", + # "url": "https://pokeapi.co/api/v2/move-learn-method/1/" + # }, + # "version_group": { + # "name": "xd", + # "url": "https://pokeapi.co/api/v2/version-group/13/" + # } + # }, + # { + # "level_learned_at": 1, + # "move_learn_method": { + # "name": "level-up", + # "url": "https://pokeapi.co/api/v2/move-learn-method/1/" + # }, + # "version_group": { + # "name": "black-2-white-2", + # "url": "https://pokeapi.co/api/v2/version-group/14/" + # } + # }, + # { + # "level_learned_at": 1, + # "move_learn_method": { + # "name": "level-up", + # "url": "https://pokeapi.co/api/v2/move-learn-method/1/" + # }, + # "version_group": { + # "name": "x-y", + # "url": "https://pokeapi.co/api/v2/version-group/15/" + # } + # }, + # { + # "level_learned_at": 1, + # "move_learn_method": { + # "name": "level-up", + # "url": "https://pokeapi.co/api/v2/move-learn-method/1/" + # }, + # "version_group": { + # "name": "omega-ruby-alpha-sapphire", + # "url": "https://pokeapi.co/api/v2/version-group/16/" + # } + # }, + # { + # "level_learned_at": 1, + # "move_learn_method": { + # "name": "level-up", + # "url": "https://pokeapi.co/api/v2/move-learn-method/1/" + # }, + # "version_group": { + # "name": "sun-moon", + # "url": "https://pokeapi.co/api/v2/version-group/17/" + # } + # }, + # { + # "level_learned_at": 1, + # "move_learn_method": { + # "name": "level-up", + # "url": "https://pokeapi.co/api/v2/move-learn-method/1/" + # }, + # "version_group": { + # "name": "ultra-sun-ultra-moon", + # "url": "https://pokeapi.co/api/v2/version-group/18/" + # } + # }, + # { + # "level_learned_at": 1, + # "move_learn_method": { + # "name": "level-up", + # "url": "https://pokeapi.co/api/v2/move-learn-method/1/" + # }, + # "version_group": { + # "name": "lets-go-pikachu-lets-go-eevee", + # "url": "https://pokeapi.co/api/v2/version-group/19/" + # } + # }, + # { + # "level_learned_at": 1, + # "move_learn_method": { + # "name": "level-up", + # "url": "https://pokeapi.co/api/v2/move-learn-method/1/" + # }, + # "version_group": { + # "name": "sword-shield", + # "url": "https://pokeapi.co/api/v2/version-group/20/" + # } + # }, + # { + # "level_learned_at": 1, + # "move_learn_method": { + # "name": "level-up", + # "url": "https://pokeapi.co/api/v2/move-learn-method/1/" + # }, + # "version_group": { + # "name": "brilliant-diamond-and-shining-pearl", + # "url": "https://pokeapi.co/api/v2/version-group/23/" + # } + # }, + # { + # "level_learned_at": 1, + # "move_learn_method": { + # "name": "level-up", + # "url": "https://pokeapi.co/api/v2/move-learn-method/1/" + # }, + # "version_group": { + # "name": "scarlet-violet", + # "url": "https://pokeapi.co/api/v2/version-group/25/" + # } + # } + # ] + # }, + + # "move": { + # "name": "scratch", + # "url": "https://pokeapi.co/api/v2/move/10/" + # }, + # "version_group_details": [ + # { + # "level_learned_at": 1, + # "move_learn_method": { + # "name": "level-up", + # "url": "https://pokeapi.co/api/v2/move-learn-method/1/" + # }, + # "version_group": { + # "name": "red-blue", + # "url": "https://pokeapi.co/api/v2/version-group/1/" + # } + # }, + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'move', 'version_group_details' ], + 'properties': { + 'move': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'scratch' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/move/10/' + } + } + }, + 'version_group_details': { + 'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'level_learned_at', 'move_learn_method', 'version_group' ], + 'properties': { + 'level_learned_at': { + 'type': 'number', + 'example': 1 + }, + 'move_learn_method': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'level-up' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/move-learn-method/1/' + } + } + }, + 'version_group': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'red-blue' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/version-group/1/' + } + } + } + } + } + } + } + } + }) def get_pokemon_moves(self, obj): version_objects = VersionGroup.objects.all() version_data = VersionGroupSummarySerializer( @@ -4245,7 +4615,67 @@ def get_pokemon_moves(self, obj): return move_list - @extend_schema_field(OpenApiTypes.OBJECT) + # { + # "item": { + # "name": "soft-sand", + # "url": "https://pokeapi.co/api/v2/item/214/" + # }, + # "version_details": [ + # { + # "rarity": 5, + # "version": { + # "name": "diamond", + # "url": "https://pokeapi.co/api/v2/version/12/" + # } + # }, + @extend_schema_field(field={'type': 'object', + 'required': [ 'item', 'version_details' ], + 'properties': { + 'item': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'soft-sand' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/item/214/' + } + } + }, + 'version_details': { + 'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'rarity', 'version' ], + 'properties': { + 'rarity': { + 'type': 'number', + 'example': 5 + }, + 'version': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'diamond' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/version/12/' + } + } + } + } + } + }, + } + }) def get_pokemon_held_items(self, obj): # Get items related to this pokemon and pull out unique Item IDs pokemon_items = PokemonItem.objects.filter(pokemon_id=obj).order_by("item_id") @@ -4279,7 +4709,45 @@ def get_pokemon_held_items(self, obj): return item_list - @extend_schema_field(OpenApiTypes.OBJECT) + # { + # "ability": { + # "name": "sand-veil", + # "url": "https://pokeapi.co/api/v2/ability/8/" + # }, + # "is_hidden": false, + # "slot": 1 + # }, + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'ability', 'is_hidden', 'slot' ], + 'properties': { + 'ability': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'sand-veil' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/ability/8/' + } + } + }, + 'is_hidden': { + 'type': 'boolean', + 'example': False + }, + 'slot': { + 'type': 'number', + 'example': 1 + }, + } + } + }) def get_pokemon_abilities(self, obj): pokemon_ability_objects = PokemonAbility.objects.filter(pokemon=obj) data = PokemonAbilitySerializer( @@ -4293,7 +4761,77 @@ def get_pokemon_abilities(self, obj): return abilities - @extend_schema_field(OpenApiTypes.OBJECT) + # { + # "abilities": [ + # { + # "ability": { + # "name": "levitate", + # "url": "https://pokeapi.co/api/v2/ability/26/" + # }, + # "is_hidden": false, + # "slot": 1 + # } + # ], + # "generation": { + # "name": "generation-vi", + # "url": "https://pokeapi.co/api/v2/generation/6/" + # } + # } + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'abilities', 'generation' ], + 'properties': { + 'abilities': { + 'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'ability', 'is_hidden', 'slot' ], + 'properties': { + 'ability': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'levitate' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/ability/26/' + } + } + }, + 'is_hidden': { + 'type': 'boolean', + 'example': False + }, + 'slot': { + 'type': 'number', + 'example': 1 + } + } + } + }, + 'generation': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'generation-vi' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/generation/6/' + } + } + }, + } + } + }) def get_past_pokemon_abilities(self, obj): pokemon_past_ability_objects = PokemonAbilityPast.objects.filter(pokemon=obj) pokemon_past_abilities = PokemonAbilityPastSerializer( @@ -4329,7 +4867,40 @@ def get_past_pokemon_abilities(self, obj): return final_data - @extend_schema_field(OpenApiTypes.OBJECT) + # { + # "slot": 1, + # "type": { + # "name": "ghost", + # "url": "https://pokeapi.co/api/v2/type/8/" + # } + # }, + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'slot', 'type' ], + 'properties': { + 'slot': { + 'type': 'number', + 'example': 1 + }, + 'type': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'ghost' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/type/8/' + } + } + } + } + } + }) def get_pokemon_types(self, obj): poke_type_objects = PokemonType.objects.filter(pokemon=obj) poke_types = PokemonTypeSerializer( @@ -4341,7 +4912,74 @@ def get_pokemon_types(self, obj): return poke_types - @extend_schema_field(OpenApiTypes.OBJECT) + # "past_types": [ + # { + # "generation": { + # "name": "generation-v", + # "url": "https://pokeapi.co/api/v2/generation/5/" + # }, + # "types": [ + # { + # "slot": 1, + # "type": { + # "name": "normal", + # "url": "https://pokeapi.co/api/v2/type/1/" + # } + # } + # ] + # } + # ], + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'generation', 'types' ], + 'properties':{ + 'generation': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'generation-v' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/generation/5/' + } + } + }, + 'types': { + 'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'slot', 'type' ], + 'properties': { + 'slot': { + 'type': 'number', + 'example': 1 + }, + 'type': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'normal' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/type/1/' + } + } + }, + } + } + }, + } + } + }) def get_past_pokemon_types(self, obj): poke_past_type_objects = PokemonTypePast.objects.filter(pokemon=obj) poke_past_types = PokemonTypePastSerializer( @@ -4377,7 +5015,10 @@ def get_past_pokemon_types(self, obj): return final_data - @extend_schema_field(OpenApiTypes.OBJECT) + @extend_schema_field(field={ + 'type': 'string', + 'example': 'https://pokeapi.co/api/v2/pokemon/1/encounters' + }) def get_encounters(self, obj): return reverse("pokemon_encounters", kwargs={"pokemon_id": obj.pk}) From 0fabe2c70cc22c20547657a0528ed04ea07b0b05 Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Sun, 3 Mar 2024 20:49:15 -0600 Subject: [PATCH 29/49] fix: add `pokemon-species` schema_field definitions --- openapi.yml | 136 +++++++++++++++++++++++++++++--- pokemon_v2/serializers.py | 160 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 278 insertions(+), 18 deletions(-) diff --git a/openapi.yml b/openapi.yml index 2f8d23f7f..c2cc408c7 100644 --- a/openapi.yml +++ b/openapi.yml @@ -3640,8 +3640,20 @@ components: $ref: '#/components/schemas/EvolutionTriggerName' readOnly: true pokemon_species: - type: object - additionalProperties: {} + type: array + items: + type: object + required: + - name + - url + properties: + name: + type: string + example: ivysaur + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/pokemon-species/2/ readOnly: true required: - id @@ -7561,8 +7573,20 @@ components: $ref: '#/components/schemas/PokemonDexEntry' readOnly: true egg_groups: - type: object - additionalProperties: {} + type: array + items: + type: object + required: + - name + - url + properties: + name: + type: string + example: monster + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/egg-group/1/ readOnly: true color: $ref: '#/components/schemas/PokemonColorSummary' @@ -7577,12 +7601,58 @@ components: generation: $ref: '#/components/schemas/GenerationSummary' names: - type: object - additionalProperties: {} + type: array + items: + type: object + required: + - language + - name + properties: + language: + type: object + required: + - name + - url + properties: + name: + type: string + example: en + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/language/9/ + name: + type: string + example: bulbasaur readOnly: true pal_park_encounters: - type: object - additionalProperties: {} + type: array + items: + type: object + required: + - area + - base_score + - rate + properties: + area: + type: object + required: + - name + - url + properties: + name: + type: string + example: field + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/pal-park-area/2/ + base_score: + type: number + example: 50 + rate: + type: number + example: 30 readOnly: true form_descriptions: type: array @@ -7595,12 +7665,54 @@ components: $ref: '#/components/schemas/PokemonSpeciesFlavorText' readOnly: true genera: - type: object - additionalProperties: {} + type: array + items: + type: object + required: + - genus + - language + properties: + genus: + type: string + example: Seed Pokémon + language: + type: object + required: + - name + - url + properties: + name: + type: string + example: en + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/language/9/ readOnly: true varieties: - type: object - additionalProperties: {} + type: array + items: + type: object + required: + - is_default + - pokemon + properties: + is_default: + type: boolean + example: true + pokemon: + type: object + required: + - name + - url + properties: + name: + type: string + example: bulbasaur + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/pokemon/1/ readOnly: true required: - color diff --git a/pokemon_v2/serializers.py b/pokemon_v2/serializers.py index edfcce0a1..2240cc927 100644 --- a/pokemon_v2/serializers.py +++ b/pokemon_v2/serializers.py @@ -5044,7 +5044,24 @@ class Meta: model = EvolutionTrigger fields = ("id", "name", "names", "pokemon_species") - @extend_schema_field(OpenApiTypes.OBJECT) + @extend_schema_field(field={ + 'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'ivysaur' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/pokemon-species/2/' + } + } + } + }) def get_species(self, obj): evo_objects = PokemonEvolution.objects.filter(evolution_trigger=obj) species_list = [] @@ -5152,7 +5169,33 @@ class Meta: "varieties", ) - @extend_schema_field(OpenApiTypes.OBJECT) + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'language', 'name' ], + 'properties': { + 'language': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'en' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/language/9/' + } + } + }, + 'name': { + 'type': 'string', + 'example': 'bulbasaur' + } + } + } + }) def get_pokemon_names(self, obj): species_results = PokemonSpeciesName.objects.filter(pokemon_species=obj) species_serializer = PokemonSpeciesNameSerializer( @@ -5166,7 +5209,40 @@ def get_pokemon_names(self, obj): return data - @extend_schema_field(OpenApiTypes.OBJECT) + # { + # "genus": "Seed Pokémon", + # "language": { + # "name": "en", + # "url": "https://pokeapi.co/api/v2/language/9/" + # } + # }, + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'genus', 'language' ], + 'properties': { + 'genus': { + 'type': 'string', + 'example': 'Seed Pokémon' + }, + 'language': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'en' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/language/9/' + } + } + } + } + } + }) def get_pokemon_genera(self, obj): results = PokemonSpeciesName.objects.filter(pokemon_species=obj) serializer = PokemonSpeciesNameSerializer( @@ -5182,7 +5258,23 @@ def get_pokemon_genera(self, obj): return genera - @extend_schema_field(OpenApiTypes.OBJECT) + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'monster' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/egg-group/1/' + } + } + } + }) def get_pokemon_egg_groups(self, obj): results = PokemonEggGroup.objects.filter(pokemon_species=obj) data = PokemonEggGroupSerializer(results, many=True, context=self.context).data @@ -5192,7 +5284,33 @@ def get_pokemon_egg_groups(self, obj): return groups - @extend_schema_field(OpenApiTypes.OBJECT) + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'is_default', 'pokemon' ], + 'properties': { + 'is_default': { + 'type': 'boolean', + 'example': True + }, + 'pokemon': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'bulbasaur' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/pokemon/1/' + } + } + } + } + } + }) def get_pokemon_varieties(self, obj): results = Pokemon.objects.filter(pokemon_species=obj) summary_data = PokemonSummarySerializer( @@ -5212,7 +5330,37 @@ def get_pokemon_varieties(self, obj): return varieties - @extend_schema_field(OpenApiTypes.OBJECT) + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'area', 'base_score', 'rate' ], + 'properties': { + 'area': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'field' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/pal-park-area/2/' + } + } + }, + 'base_score': { + 'type': 'number', + 'example': 50 + }, + 'rate': { + 'type': 'number', + 'example': 30 + } + } + } + }) def get_encounters(self, obj): pal_park_objects = PalPark.objects.filter(pokemon_species=obj) parks = PalParkSerializer( From da11f734dbef91abea3e8b1d2e4d281c3ae23123 Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Sun, 3 Mar 2024 22:29:50 -0600 Subject: [PATCH 30/49] fix: add `evolution-chain` schema_field definitions --- openapi.yml | 179 +++++++++++++++++++++++++++++- pokemon_v2/serializers.py | 224 +++++++++++++++++++++++++++++++++++++- 2 files changed, 401 insertions(+), 2 deletions(-) diff --git a/openapi.yml b/openapi.yml index c2cc408c7..d507ff1c7 100644 --- a/openapi.yml +++ b/openapi.yml @@ -3610,7 +3610,184 @@ components: $ref: '#/components/schemas/ItemSummary' chain: type: object - additionalProperties: {} + required: + - evolution_details + - evolves_to + - is_baby + - species + properties: + evolution_details: + type: array + items: {} + example: [] + evolves_to: + type: array + items: + type: object + required: + - evolution_details + - evolves_to + - is_baby + - species + properties: + evolution_details: + type: array + items: + type: object + required: + - gender + - held_item + - item + - known_move + - known_move_type + - location + - min_affection + - min_beauty + - min_happiness + - min_level + - needs_overworld_rain + - party_species + - party_type + - relative_physical_stats + - time_of_day + - trade_species + - trigger + - turn_upside_down + properties: + gender: + type: object + nullable: true + required: + - name + - url + properties: + name: + type: string + example: 1 + url: + type: string + format: uri + example: 2 + held_item: + type: object + nullable: true + required: + - name + - url + properties: + name: + type: string + example: 1 + url: + type: string + format: uri + example: 2 + item: + type: object + nullable: true + required: + - name + - url + properties: + name: + type: string + example: 1 + url: + type: string + format: uri + example: 2 + known_move: + type: '' + nullable: true + known_move_type: + type: '' + nullable: true + location: + type: object + nullable: true + required: + - name + - url + properties: + name: + type: string + url: + type: string + format: uri + min_affection: + type: number + nullable: true + min_beauty: + type: number + nullable: true + min_happiness: + type: number + nullable: true + min_level: + type: number + nullable: true + needs_overworld_rain: + type: boolean + nullable: true + party_species: + type: string + nullable: true + party_type: + type: string + nullable: true + relative_physical_stats: + type: string + nullable: true + time_of_day: + type: string + trade_species: + type: string + nullable: true + trigger: + type: object + required: + - name + - url + properties: + name: + type: string + url: + type: string + format: uri + turn_upside_down: + type: boolean + is_baby: + type: boolean + example: true + species: + type: object + required: + - name + - url + properties: + name: + type: string + example: happiny + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/pokemon-species/440/ + is_baby: + type: boolean + example: true + species: + type: object + required: + - name + - url + properties: + name: + type: string + example: happiny + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/pokemon-species/440/ readOnly: true required: - baby_trigger_item diff --git a/pokemon_v2/serializers.py b/pokemon_v2/serializers.py index 2240cc927..f336ea19b 100644 --- a/pokemon_v2/serializers.py +++ b/pokemon_v2/serializers.py @@ -5418,7 +5418,229 @@ class Meta: model = EvolutionChain fields = ("id", "baby_trigger_item", "chain") - @extend_schema_field(OpenApiTypes.OBJECT) + # TODO: Revisit Schema + @extend_schema_field(field={'type': 'object', + 'required': [ + 'evolution_details', + 'evolves_to', + 'is_baby', + 'species' + ], + 'properties': { + 'evolution_details': { + 'type': 'array', + 'items': { + }, + 'example': [] + }, + 'evolves_to': { + 'type': 'array', + 'items': { + 'type': 'object', + 'required': [ + 'evolution_details', + 'evolves_to', + 'is_baby', + 'species' + ], + 'properties': { + 'evolution_details': { + 'type': 'array', + 'items': { + 'type': 'object', + 'required': [ + 'gender', + 'held_item', + 'item', + 'known_move', + 'known_move_type', + 'location', + 'min_affection', + 'min_beauty', + 'min_happiness', + 'min_level', + 'needs_overworld_rain', + 'party_species', + 'party_type', + 'relative_physical_stats', + 'time_of_day', + 'trade_species', + 'trigger', + 'turn_upside_down' + ], + 'properties': { + 'gender': { + 'type': '', + 'nullable': True, + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 1 + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 2 + } + } + }, + 'held_item': { + 'type': 'object', + 'nullable': True, + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 1 + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 2 + } + } + }, + 'item': { + 'type': 'object', + 'nullable': True, + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 1 + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 2 + } + } + }, + 'known_move': { + 'type': '', + 'nullable': True, + }, + 'known_move_type': { + 'type': '', + 'nullable': True, + }, + 'location': { + 'type': 'object', + 'nullable': True, + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + }, + 'url': { + 'type': 'string', + 'format': 'uri', + } + } + }, + 'min_affection': { + 'type': 'number', + 'nullable': True + }, + 'min_beauty': { + 'type': 'number', + 'nullable': True + }, + 'min_happiness': { + 'type': 'number', + 'nullable': True + }, + 'min_level': { + 'type': 'number', + 'nullable': True + }, + 'needs_overworld_rain': { + 'type': 'boolean', + 'nullable': True + }, + 'party_species': { + 'type': 'string', + 'nullable': True + }, + 'party_type': { + 'type': 'string', + 'nullable': True + }, + 'relative_physical_stats': { + 'type': 'string', + 'nullable': True + }, + 'time_of_day': { + 'type': 'string' + }, + 'trade_species': { + 'type': 'string', + 'nullable': True + }, + 'trigger': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + }, + 'url': { + 'type': 'string', + 'format': 'uri' + } + } + }, + 'turn_upside_down': { + 'type': 'boolean' + } + } + } + }, + 'is_baby': { + 'type': 'boolean', + 'example': True + }, + 'species': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'happiny' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/pokemon-species/440/' + } + } + } + } + } + }, + 'is_baby': { + 'type': 'boolean', + 'example': True + }, + 'species': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'happiny' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/pokemon-species/440/' + } + } + } + } + }) def build_chain(self, obj): chain_id = obj.id From 8060b59125cc4790beb107d658d1200e2d4cb0f8 Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Mon, 4 Mar 2024 00:23:24 -0600 Subject: [PATCH 31/49] fix: add `pokeathlon_stat` schema_field definitions --- openapi.yml | 55 ++++++++++++++++++++++++++++++++- pokemon_v2/serializers.py | 64 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 117 insertions(+), 2 deletions(-) diff --git a/openapi.yml b/openapi.yml index d507ff1c7..58575e4bb 100644 --- a/openapi.yml +++ b/openapi.yml @@ -6865,7 +6865,60 @@ components: maxLength: 100 affecting_natures: type: object - additionalProperties: {} + required: + - decrease + - increase + properties: + decrease: + type: array + items: + type: object + required: + - max_change + - nature + properties: + max_change: + type: number + maximum: -1 + example: -1 + nature: + type: object + required: + - name + - url + properties: + name: + type: string + example: hardy + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/nature/1/ + increase: + type: array + items: + type: object + required: + - max_change + - nature + properties: + max_change: + type: number + minimum: 1 + example: 2 + nature: + type: object + required: + - name + - url + properties: + name: + type: string + example: hardy + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/nature/1/ readOnly: true names: type: array diff --git a/pokemon_v2/serializers.py b/pokemon_v2/serializers.py index f336ea19b..ec078601c 100644 --- a/pokemon_v2/serializers.py +++ b/pokemon_v2/serializers.py @@ -5753,7 +5753,69 @@ class Meta: model = PokeathlonStat fields = ("id", "name", "affecting_natures", "names") - @extend_schema_field(OpenApiTypes.OBJECT) + @extend_schema_field(field={'type': 'object', + 'required': [ 'decrease', 'increase' ], + 'properties': { + 'decrease': { + 'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'max_change', 'nature' ], + 'properties': { + 'max_change': { + 'type': 'number', + 'maximum': -1, + 'example': -1 + }, + 'nature': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'hardy' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/nature/1/' + } + } + } + } + } + }, + 'increase': { + 'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'max_change', 'nature' ], + 'properties': { + 'max_change': { + 'type': 'number', + 'minimum': 1, + 'example': 2 + }, + 'nature': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'hardy' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/nature/1/' + } + } + } + } + } + } + } + }) def get_natures_that_affect(self, obj): stat_change_objects = NaturePokeathlonStat.objects.filter(pokeathlon_stat=obj) stat_changes = NaturePokeathlonStatSerializer( From 807fbc1869a3ac63c5f2b11b169bbda696f10e17 Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Mon, 4 Mar 2024 00:44:24 -0600 Subject: [PATCH 32/49] fix: add `pokedex` schema_field definitions --- openapi.yml | 41 ++++++++++++++++++++++++++++++---- pokemon_v2/serializers.py | 46 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 81 insertions(+), 6 deletions(-) diff --git a/openapi.yml b/openapi.yml index 58575e4bb..79dd09748 100644 --- a/openapi.yml +++ b/openapi.yml @@ -6986,14 +6986,47 @@ components: $ref: '#/components/schemas/PokedexName' readOnly: true pokemon_entries: - type: object - additionalProperties: {} + type: array + items: + type: object + required: + - entry_number + - pokemon_species + properties: + entry_number: + type: number + example: 1 + pokemon_species: + type: object + required: + - name + - url + properties: + name: + type: string + example: bulbasaur + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/pokemon-species/1/ readOnly: true region: $ref: '#/components/schemas/RegionSummary' version_groups: - type: object - additionalProperties: {} + type: array + items: + type: object + required: + - name + - url + properties: + name: + type: string + example: the-teal-mask + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/version-group/26/ readOnly: true required: - descriptions diff --git a/pokemon_v2/serializers.py b/pokemon_v2/serializers.py index ec078601c..f2c0ee960 100644 --- a/pokemon_v2/serializers.py +++ b/pokemon_v2/serializers.py @@ -5874,7 +5874,33 @@ class Meta: "version_groups", ) - @extend_schema_field(OpenApiTypes.OBJECT) + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'entry_number', 'pokemon_species' ], + 'properties': { + 'entry_number': { + 'type': 'number', + 'example': 1 + }, + 'pokemon_species': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'bulbasaur' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/pokemon-species/1/' + } + } + } + } + } + }) def get_pokedex_entries(self, obj): results = PokemonDexNumber.objects.filter(pokedex=obj).order_by( "pokedex_number" @@ -5889,7 +5915,23 @@ def get_pokedex_entries(self, obj): return data - @extend_schema_field(OpenApiTypes.OBJECT) + @extend_schema_field(field={'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'the-teal-mask' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/version-group/26/' + } + } + } + }) def get_pokedex_version_groups(self, obj): dex_group_objects = PokedexVersionGroup.objects.filter(pokedex=obj) dex_groups = PokedexVersionGroupSerializer( From 8198fae37a1219353fb6512015efa550f13db9a9 Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Mon, 4 Mar 2024 01:05:48 -0600 Subject: [PATCH 33/49] fix: add `version-group` schema_field definitions --- openapi.yml | 48 +++++++++++++++++++++++++++---- pokemon_v2/serializers.py | 59 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 98 insertions(+), 9 deletions(-) diff --git a/openapi.yml b/openapi.yml index 79dd09748..c3bed477c 100644 --- a/openapi.yml +++ b/openapi.yml @@ -8682,16 +8682,52 @@ components: generation: $ref: '#/components/schemas/GenerationSummary' move_learn_methods: - type: object - additionalProperties: {} + type: array + items: + type: object + required: + - name + - url + properties: + name: + type: string + example: level-up + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/move-learn-method/1/ readOnly: true pokedexes: - type: object - additionalProperties: {} + type: array + items: + type: object + required: + - name + - url + properties: + name: + type: string + example: kanto + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/pokedex/2/ readOnly: true regions: - type: object - additionalProperties: {} + type: array + items: + type: object + required: + - name + - url + properties: + name: + type: string + example: kanto + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/region/1/ readOnly: true versions: type: array diff --git a/pokemon_v2/serializers.py b/pokemon_v2/serializers.py index f2c0ee960..72111ad29 100644 --- a/pokemon_v2/serializers.py +++ b/pokemon_v2/serializers.py @@ -5991,7 +5991,24 @@ class Meta: "versions", ) - @extend_schema_field(OpenApiTypes.OBJECT) + @extend_schema_field(field={ + 'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'kanto' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/region/1/' + } + } + } + }) def get_version_group_regions(self, obj): vg_regions = VersionGroupRegion.objects.filter(version_group=obj) data = VersionGroupRegionSerializer( @@ -6004,7 +6021,26 @@ def get_version_group_regions(self, obj): return regions - @extend_schema_field(OpenApiTypes.OBJECT) + # "name": "level-up", + # "url": "https://pokeapi.co/api/v2/move-learn-method/1/" + @extend_schema_field(field={ + 'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'level-up' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/move-learn-method/1/' + } + } + } + }) def get_learn_methods(self, obj): learn_method_objects = VersionGroupMoveLearnMethod.objects.filter( version_group=obj @@ -6019,7 +6055,24 @@ def get_learn_methods(self, obj): return methods - @extend_schema_field(OpenApiTypes.OBJECT) + @extend_schema_field(field={ + 'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'kanto' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/pokedex/2/' + } + } + } + }) def get_version_groups_pokedexes(self, obj): dex_group_objects = PokedexVersionGroup.objects.filter(version_group=obj) dex_groups = PokedexVersionGroupSerializer( From 5c9a73d795856d2c532d029a035001c1d0124dfa Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Mon, 4 Mar 2024 02:47:43 -0600 Subject: [PATCH 34/49] fix: add `pokemon_encounters` `200` response --- openapi.yml | 98 +++++++++++++++++++++++++++++- pokemon_v2/api.py | 121 ++++++++++++++++++++++++++++++++++++-- pokemon_v2/serializers.py | 2 - 3 files changed, 213 insertions(+), 8 deletions(-) diff --git a/openapi.yml b/openapi.yml index c3bed477c..da10a55da 100644 --- a/openapi.yml +++ b/openapi.yml @@ -2518,7 +2518,103 @@ paths: - {} responses: '200': - description: No response body + content: + application/json: + schema: + type: array + items: + type: object + required: + - location_area + - version_details + properties: + location_area: + type: object + required: + - name + - url + properties: + name: + type: string + example: cerulean-city-area + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/location-area/281/ + version_details: + type: array + items: + type: object + required: + - encounter_details + - max_chance + - version + properties: + encounter_details: + type: array + items: + type: object + required: + - chance + - condition_values + - max_level + - method + - min_level + properties: + chance: + type: number + example: 100 + condition_values: + type: array + items: + type: object + required: + - name + - url + properties: + name: + type: string + example: story-progress-beat-red + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/encounter-condition-value/55/ + max_level: + type: number + example: 10 + method: + type: object + required: + - name + - url + properties: + name: + type: string + example: gift + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/encounter-method/18/ + min_level: + type: number + example: 10 + max_chance: + type: number + example: 100 + version: + type: object + required: + - name + - url + properties: + name: + type: string + example: red + url: + type: string + format: uri + example: https://pokeapi.co/api/v2/version/1/ + description: '' /api/v2/region/: get: operationId: region_list diff --git a/pokemon_v2/api.py b/pokemon_v2/api.py index 518985e58..fc672acdc 100644 --- a/pokemon_v2/api.py +++ b/pokemon_v2/api.py @@ -837,12 +837,123 @@ class VersionGroupResource(PokeapiCommonViewset): description='Handles Pokemon Encounters as a sub-resource.', summary='Get pokemon encounter', tags=[ 'encounters' ], + responses={'200': { + 'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'location_area', 'version_details' ], + 'properties': { + 'location_area': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'cerulean-city-area' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/location-area/281/' + } + } + }, + 'version_details': { + 'type': 'array', + 'items': { + 'type': 'object', + 'required': [ + 'encounter_details', + 'max_chance', + 'version' + ], + 'properties': { + 'encounter_details': { + 'type': 'array', + 'items': { + 'type': 'object', + 'required': [ + 'chance', + 'condition_values', + 'max_level', + 'method', + 'min_level' + ], + 'properties': { + 'chance': { + 'type': 'number', + 'example': 100 + }, + 'condition_values': { + 'type': 'array', + 'items': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'story-progress-beat-red' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/encounter-condition-value/55/' + } + } + } + }, + 'max_level': { + 'type': 'number', + 'example': 10 + }, + 'method': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'gift' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/encounter-method/18/' + } + } + }, + 'min_level': { + 'type': 'number', + 'example': 10 + } + } + } + }, + 'max_chance': { + 'type': 'number', + 'example': 100 + }, + 'version': { + 'type': 'object', + 'required': [ 'name', 'url' ], + 'properties': { + 'name': { + 'type': 'string', + 'example': 'red' + }, + 'url': { + 'type': 'string', + 'format': 'uri', + 'example': 'https://pokeapi.co/api/v2/version/1/' + } + } + } + } + } + } + } + } + }} ) -@extend_schema_view( - list=extend_schema( - summary='List pokemon encounters', - ) -) class PokemonEncounterView(APIView): def get(self, request, pokemon_id): diff --git a/pokemon_v2/serializers.py b/pokemon_v2/serializers.py index 72111ad29..b45a4ac69 100644 --- a/pokemon_v2/serializers.py +++ b/pokemon_v2/serializers.py @@ -926,8 +926,6 @@ class Meta: "condition_values", ) - # no response at the moment - @extend_schema_field(OpenApiTypes.OBJECT) def get_encounter_conditions(self, obj): condition_values = EncounterConditionValueMap.objects.filter(encounter=obj) data = EncounterConditionValueMapSerializer( From cfff93d6ed9ebbbd4342aa80849ef497420e5452 Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Mon, 4 Mar 2024 03:06:12 -0600 Subject: [PATCH 35/49] global tags --- config/settings.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/config/settings.py b/config/settings.py index 00c7d392e..58cc0870a 100755 --- a/config/settings.py +++ b/config/settings.py @@ -147,6 +147,19 @@ 'VERSION': '2.7.0', 'SERVE_INCLUDE_SCHEMA': False, 'OAS_VERSION': '3.1.0', - 'COMPONENT_SPLIT_REQUEST': True + 'COMPONENT_SPLIT_REQUEST': True, + 'TAGS': [ + 'pokemon', + 'evolution', + 'berries', + 'items', + 'machines', + 'location', + 'contest', + 'moves', + 'encounters', + 'games', + 'utility' + ] } From 2b794c0ec690156e152fcedec3ff2e5f98cb3509 Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Mon, 4 Mar 2024 03:06:51 -0600 Subject: [PATCH 36/49] global tags --- openapi.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/openapi.yml b/openapi.yml index da10a55da..6f12202be 100644 --- a/openapi.yml +++ b/openapi.yml @@ -8885,5 +8885,17 @@ components: name: sessionid servers: - url: https://pokeapi.co +tags: +- pokemon +- evolution +- berries +- items +- machines +- location +- contest +- moves +- encounters +- games +- utility externalDocs: url: https://pokeapi.co/docs/v2 From c7c2c46f496456d5a05d4745dd603a1950f2c8dc Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Mon, 4 Mar 2024 03:07:09 -0600 Subject: [PATCH 37/49] typo --- pokemon_v2/api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pokemon_v2/api.py b/pokemon_v2/api.py index fc672acdc..912d90ca6 100644 --- a/pokemon_v2/api.py +++ b/pokemon_v2/api.py @@ -723,12 +723,12 @@ class PokemonResource(PokeapiCommonViewset): @extend_schema( description='A Pokémon Species forms the basis for at least one Pokémon. Attributes of a Pokémon species are shared across all varieties of Pokémon within the species. A good example is Wormadam; Wormadam is the species which can be found in three different varieties, Wormadam-Trash, Wormadam-Sandy and Wormadam-Plant.', - summary='Get pokemon spec', + summary='Get pokemon species', tags=[ 'pokemon' ], ) @extend_schema_view( list=extend_schema( - summary='List pokemon specs', + summary='List pokemon species', ) ) class PokemonSpeciesResource(PokeapiCommonViewset): From 4688b0d071adcd9ec6b0693bf091ed54af1dfe5a Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Tue, 5 Mar 2024 00:37:02 -0600 Subject: [PATCH 38/49] tidy --- config/settings.py | 4 ++-- pokemon_v2/api.py | 4 ++-- pokemon_v2/serializers.py | 43 +++++++++++++++++++-------------------- 3 files changed, 25 insertions(+), 26 deletions(-) diff --git a/config/settings.py b/config/settings.py index 58cc0870a..e561bc645 100755 --- a/config/settings.py +++ b/config/settings.py @@ -159,7 +159,7 @@ 'moves', 'encounters', 'games', - 'utility' - ] + 'utility', + ], } diff --git a/pokemon_v2/api.py b/pokemon_v2/api.py index 912d90ca6..27ee6c9df 100644 --- a/pokemon_v2/api.py +++ b/pokemon_v2/api.py @@ -4,7 +4,7 @@ from rest_framework.views import APIView from django.shortcuts import get_object_or_404 from django.http import Http404 -from drf_spectacular.utils import extend_schema, extend_schema_serializer, extend_schema_view +from drf_spectacular.utils import extend_schema, extend_schema_view from .models import * from .serializers import * @@ -862,7 +862,7 @@ class VersionGroupResource(PokeapiCommonViewset): 'type': 'array', 'items': { 'type': 'object', - 'required': [ + 'required': [ 'encounter_details', 'max_chance', 'version' diff --git a/pokemon_v2/serializers.py b/pokemon_v2/serializers.py index b45a4ac69..fd4db0228 100644 --- a/pokemon_v2/serializers.py +++ b/pokemon_v2/serializers.py @@ -2,8 +2,7 @@ import json from django.urls import reverse from rest_framework import serializers -from drf_spectacular.types import OpenApiTypes -from drf_spectacular.utils import extend_schema_field, extend_schema, OpenApiParameter, OpenApiExample, extend_schema_serializer +from drf_spectacular.utils import extend_schema_field # pylint: disable=redefined-builtin @@ -1115,7 +1114,7 @@ def get_method_rates(self, obj): }, 'encounter_details': { 'type': 'object', - 'required': [ + 'required': [ 'min_level', 'max_level', 'condition_value', @@ -2106,13 +2105,13 @@ class Meta: fields = ("id", "name", "berries", "contest_type", "names") @extend_schema_field(field={'type': 'array', - 'items': { + 'items': { 'type': 'object', 'required': [ 'potency', 'berry' ], 'properties': { 'potency': { 'type': 'integer', - 'example': 10 + 'example': 10 }, 'berry': { 'type': 'object', @@ -2172,13 +2171,13 @@ class Meta: ) @extend_schema_field(field={'type': 'array', - 'items': { + 'items': { 'type': 'object', 'required': [ 'potency', 'flavor' ], 'properties': { 'potency': { 'type': 'integer', - 'example': 10 + 'example': 10 }, 'flavor': { 'type': 'object', @@ -2243,14 +2242,14 @@ class Meta: fields = ("id", "name", "names", "pokemon_species") @extend_schema_field(field={'type': 'array', - 'items': { + 'items': { 'type': 'object', 'required': [ 'potency', 'flavor' ], 'properties': { 'name': { 'type': 'string', 'description': 'Pokemon species name.', - 'example': 'bulbasaur' + 'example': 'bulbasaur' }, 'url': { 'type': 'string', @@ -2364,7 +2363,7 @@ def add_type_entry(self, relations, type, damage_factor, direction="_damage_to") 'half_damage_from', 'double_damage_from' ], - 'properties': { + 'properties': { 'no_damage_to': { 'type': 'array', 'items': { @@ -2540,7 +2539,7 @@ def remove_type_entry(self, relations, type, direction="_damage_to"): # returns past type relationships for the given type object @extend_schema_field(field={'type': 'array', - 'items': { + 'items': { 'type': 'object', 'required': [ 'generation', 'damage_relations' ], 'properties': { @@ -2569,7 +2568,7 @@ def remove_type_entry(self, relations, type, direction="_damage_to"): 'half_damage_from', 'double_damage_from' ], - 'properties': { + 'properties': { 'no_damage_to': { 'type': 'array', 'items': { @@ -2778,13 +2777,13 @@ def type_is_present(self, type, current_gen): return gen_introduced.id <= current_gen.id @extend_schema_field(field={'type': 'array', - 'items': { + 'items': { 'type': 'object', 'required': [ 'potency', 'flavor' ], 'properties': { 'slot': { 'type': 'integer', - 'example': 1 + 'example': 1 }, 'pokemon': { 'type': 'object', @@ -2913,7 +2912,7 @@ class Meta: fields = ("id", "name", "moves", "names") @extend_schema_field(field={'type': 'array', - 'items': { + 'items': { 'type': 'object', 'required': [ 'name', 'url' ], 'properties': { @@ -2960,7 +2959,7 @@ class Meta: fields = ("id", "name", "descriptions", "moves") @extend_schema_field(field={'type': 'array', - 'items': { + 'items': { 'type': 'object', 'required': [ 'name', 'url' ], 'properties': { @@ -3071,7 +3070,7 @@ class Meta: ) @extend_schema_field(field={'type': 'array', - 'items': { + 'items': { 'type': 'object', 'required': [ 'effect', 'short_effect', 'language' ], 'properties': { @@ -3199,7 +3198,7 @@ class Meta: ) @extend_schema_field(field={'type': 'array', - 'items': { + 'items': { 'type': 'object', 'required': [ 'name', 'url' ], 'properties': { @@ -3233,7 +3232,7 @@ def get_learned_by_pokemon(self, obj): return pokemon_list @extend_schema_field(field={'type': 'array', - 'items': { + 'items': { 'type': 'object', 'required': [ 'machine', 'version_group' ], 'properties': { @@ -3287,7 +3286,7 @@ def get_move_machines(self, obj): return machines @extend_schema_field(field={'type': 'object', - 'properties': { + 'properties': { 'required': [ 'normal', 'super' ], 'normal': { 'type': 'object', @@ -3437,7 +3436,7 @@ def get_combos(self, obj): return details @extend_schema_field(field={'type': 'array', - 'items': { + 'items': { 'type': 'object', 'required': [ 'effect', 'short_effect', 'language' ], 'properties': { @@ -3482,7 +3481,7 @@ def get_effect_text(self, obj): return data @extend_schema_field(field={'type': 'array', - 'items': { + 'items': { 'type': 'object', 'required': [ 'effect_entries', 'version_group' ], 'properties': { From ae48daee015d9d64cd80661d819a0e1cd6e664f5 Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Tue, 5 Mar 2024 00:42:10 -0600 Subject: [PATCH 39/49] docs(openapi): update `openapi.yml` --- openapi.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openapi.yml b/openapi.yml index 6f12202be..195508277 100644 --- a/openapi.yml +++ b/openapi.yml @@ -2413,7 +2413,7 @@ paths: of a Pokémon species are shared across all varieties of Pokémon within the species. A good example is Wormadam; Wormadam is the species which can be found in three different varieties, Wormadam-Trash, Wormadam-Sandy and Wormadam-Plant. - summary: List pokemon specs + summary: List pokemon species parameters: - name: limit required: false @@ -2447,7 +2447,7 @@ paths: of a Pokémon species are shared across all varieties of Pokémon within the species. A good example is Wormadam; Wormadam is the species which can be found in three different varieties, Wormadam-Trash, Wormadam-Sandy and Wormadam-Plant. - summary: Get pokemon spec + summary: Get pokemon species parameters: - in: path name: id From e51c11e8b887271d0f6c8ceeaae0b5a129dac7f6 Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Tue, 5 Mar 2024 00:53:45 -0600 Subject: [PATCH 40/49] ci(nix-shell): add `black` --- default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/default.nix b/default.nix index 1775fe381..f5ae82fe7 100644 --- a/default.nix +++ b/default.nix @@ -18,6 +18,7 @@ in pkgs.mkShell rec { # python310Packages.django-cors-headers # Required dependancies + black taglib openssl git From d7726206998bc9e047e467e00f6c73c097d88914 Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Tue, 5 Mar 2024 00:54:48 -0600 Subject: [PATCH 41/49] test: `make format` --- config/settings.py | 45 +- pokemon_v2/api.py | 800 ++++--- pokemon_v2/serializers.py | 4439 ++++++++++++++++++------------------- 3 files changed, 2561 insertions(+), 2723 deletions(-) diff --git a/config/settings.py b/config/settings.py index e561bc645..98d3bbdf0 100755 --- a/config/settings.py +++ b/config/settings.py @@ -99,7 +99,7 @@ "corsheaders", "rest_framework", "cachalot", - 'drf_spectacular', + "drf_spectacular", ) + CUSTOM_APPS @@ -117,7 +117,7 @@ "DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.LimitOffsetPagination", "PAGE_SIZE": 20, "PAGINATE_BY": 20, - 'DEFAULT_SCHEMA_CLASS': 'drf_spectacular.openapi.AutoSchema', + "DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema", } @@ -140,26 +140,25 @@ DEFAULT_AUTO_FIELD = "django.db.models.AutoField" SPECTACULAR_SETTINGS = { - 'TITLE': 'pokeapi', - 'DESCRIPTION': 'A RESTful API for Pokémon.', - 'SERVERS': [{'url': 'https://pokeapi.co'}], - 'EXTERNAL_DOCS': {'url': 'https://pokeapi.co/docs/v2'}, - 'VERSION': '2.7.0', - 'SERVE_INCLUDE_SCHEMA': False, - 'OAS_VERSION': '3.1.0', - 'COMPONENT_SPLIT_REQUEST': True, - 'TAGS': [ - 'pokemon', - 'evolution', - 'berries', - 'items', - 'machines', - 'location', - 'contest', - 'moves', - 'encounters', - 'games', - 'utility', + "TITLE": "pokeapi", + "DESCRIPTION": "A RESTful API for Pokémon.", + "SERVERS": [{"url": "https://pokeapi.co"}], + "EXTERNAL_DOCS": {"url": "https://pokeapi.co/docs/v2"}, + "VERSION": "2.7.0", + "SERVE_INCLUDE_SCHEMA": False, + "OAS_VERSION": "3.1.0", + "COMPONENT_SPLIT_REQUEST": True, + "TAGS": [ + "pokemon", + "evolution", + "berries", + "items", + "machines", + "location", + "contest", + "moves", + "encounters", + "games", + "utility", ], } - diff --git a/pokemon_v2/api.py b/pokemon_v2/api.py index 27ee6c9df..77512e0e1 100644 --- a/pokemon_v2/api.py +++ b/pokemon_v2/api.py @@ -72,9 +72,9 @@ class PokeapiCommonViewset( @extend_schema( - description='Abilities provide passive effects for Pokémon in battle or in the overworld. Pokémon have multiple possible abilities but can have only one ability at a time. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Ability) for greater detail.', - tags=[ 'pokemon' ], - ) + description="Abilities provide passive effects for Pokémon in battle or in the overworld. Pokémon have multiple possible abilities but can have only one ability at a time. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Ability) for greater detail.", + tags=["pokemon"], +) class AbilityResource(PokeapiCommonViewset): queryset = Ability.objects.all() serializer_class = AbilityDetailSerializer @@ -82,14 +82,14 @@ class AbilityResource(PokeapiCommonViewset): @extend_schema( - description='Berries are small fruits that can provide HP and status condition restoration, stat enhancement, and even damage negation when eaten by Pokémon. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Berry) for greater detail.', - tags=[ 'berries' ], - summary='Get a berry', - ) + description="Berries are small fruits that can provide HP and status condition restoration, stat enhancement, and even damage negation when eaten by Pokémon. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Berry) for greater detail.", + tags=["berries"], + summary="Get a berry", +) @extend_schema_view( list=extend_schema( - summary='List berries', - ) + summary="List berries", + ) ) class BerryResource(PokeapiCommonViewset): queryset = Berry.objects.all() @@ -98,14 +98,14 @@ class BerryResource(PokeapiCommonViewset): @extend_schema( - description='Berries can be soft or hard. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Category:Berries_by_firmness) for greater detail.', - tags=[ 'berries' ], - summary='Get berry by firmness', - ) + description="Berries can be soft or hard. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Category:Berries_by_firmness) for greater detail.", + tags=["berries"], + summary="Get berry by firmness", +) @extend_schema_view( list=extend_schema( - summary='List berry firmness', - ) + summary="List berry firmness", + ) ) class BerryFirmnessResource(PokeapiCommonViewset): queryset = BerryFirmness.objects.all() @@ -114,14 +114,14 @@ class BerryFirmnessResource(PokeapiCommonViewset): @extend_schema( - description='Flavors determine whether a Pokémon will benefit or suffer from eating a berry based on their **nature**. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Flavor) for greater detail.', - summary='Get berries by flavor', - tags=[ 'berries' ], - ) + description="Flavors determine whether a Pokémon will benefit or suffer from eating a berry based on their **nature**. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Flavor) for greater detail.", + summary="Get berries by flavor", + tags=["berries"], +) @extend_schema_view( list=extend_schema( - summary='List berry flavors', - ) + summary="List berry flavors", + ) ) class BerryFlavorResource(PokeapiCommonViewset): queryset = BerryFlavor.objects.all() @@ -130,14 +130,14 @@ class BerryFlavorResource(PokeapiCommonViewset): @extend_schema( - description='Characteristics indicate which stat contains a Pokémon\'s highest IV. A Pokémon\'s Characteristic is determined by the remainder of its highest IV divided by 5 (gene_modulo). Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Characteristic) for greater detail.', - summary='Get charecterictic', - tags=[ 'pokemon' ], - ) + description="Characteristics indicate which stat contains a Pokémon's highest IV. A Pokémon's Characteristic is determined by the remainder of its highest IV divided by 5 (gene_modulo). Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Characteristic) for greater detail.", + summary="Get charecterictic", + tags=["pokemon"], +) @extend_schema_view( list=extend_schema( - summary='List charecterictics', - ) + summary="List charecterictics", + ) ) class CharacteristicResource(PokeapiCommonViewset): queryset = Characteristic.objects.all() @@ -146,14 +146,14 @@ class CharacteristicResource(PokeapiCommonViewset): @extend_schema( - description='Contest effects refer to the effects of moves when used in contests.', - tags=[ 'contests' ], - summary='Get contest effect', - ) + description="Contest effects refer to the effects of moves when used in contests.", + tags=["contests"], + summary="Get contest effect", +) @extend_schema_view( list=extend_schema( - summary='List contest effects', - ) + summary="List contest effects", + ) ) class ContestEffectResource(PokeapiCommonViewset): queryset = ContestEffect.objects.all() @@ -162,14 +162,14 @@ class ContestEffectResource(PokeapiCommonViewset): @extend_schema( - description='Contest types are categories judges used to weigh a Pokémon\'s condition in Pokémon contests. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Contest_condition) for greater detail.', - summary='Get contest type', - tags=[ 'contests' ], - ) + description="Contest types are categories judges used to weigh a Pokémon's condition in Pokémon contests. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Contest_condition) for greater detail.", + summary="Get contest type", + tags=["contests"], +) @extend_schema_view( list=extend_schema( - summary='List contest types', - ) + summary="List contest types", + ) ) class ContestTypeResource(PokeapiCommonViewset): queryset = ContestType.objects.all() @@ -178,14 +178,14 @@ class ContestTypeResource(PokeapiCommonViewset): @extend_schema( - description='Egg Groups are categories which determine which Pokémon are able to interbreed. Pokémon may belong to either one or two Egg Groups. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Egg_Group) for greater detail.', - summary='Get egg group', - tags=[ 'pokemon' ], - ) + description="Egg Groups are categories which determine which Pokémon are able to interbreed. Pokémon may belong to either one or two Egg Groups. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Egg_Group) for greater detail.", + summary="Get egg group", + tags=["pokemon"], +) @extend_schema_view( list=extend_schema( - summary='List egg groups', - ) + summary="List egg groups", + ) ) class EggGroupResource(PokeapiCommonViewset): queryset = EggGroup.objects.all() @@ -194,14 +194,14 @@ class EggGroupResource(PokeapiCommonViewset): @extend_schema( - description='Conditions which affect what pokemon might appear in the wild, e.g., day or night.', - summary='Get encounter condition', - tags=[ 'encounters' ], - ) + description="Conditions which affect what pokemon might appear in the wild, e.g., day or night.", + summary="Get encounter condition", + tags=["encounters"], +) @extend_schema_view( list=extend_schema( - summary='List encounter conditions', - ) + summary="List encounter conditions", + ) ) class EncounterConditionResource(PokeapiCommonViewset): queryset = EncounterCondition.objects.all() @@ -210,14 +210,14 @@ class EncounterConditionResource(PokeapiCommonViewset): @extend_schema( - description='Encounter condition values are the various states that an encounter condition can have, i.e., time of day can be either day or night.', - summary='Get encounter condition value', - tags=[ 'encounters' ], - ) + description="Encounter condition values are the various states that an encounter condition can have, i.e., time of day can be either day or night.", + summary="Get encounter condition value", + tags=["encounters"], +) @extend_schema_view( list=extend_schema( - summary='List encounter condition values', - ) + summary="List encounter condition values", + ) ) class EncounterConditionValueResource(PokeapiCommonViewset): queryset = EncounterConditionValue.objects.all() @@ -226,14 +226,14 @@ class EncounterConditionValueResource(PokeapiCommonViewset): @extend_schema( - description='Methods by which the player might can encounter Pokémon in the wild, e.g., walking in tall grass. Check out Bulbapedia for greater detail.', - summary='Get encounter method', - tags=[ 'encounters' ], - ) + description="Methods by which the player might can encounter Pokémon in the wild, e.g., walking in tall grass. Check out Bulbapedia for greater detail.", + summary="Get encounter method", + tags=["encounters"], +) @extend_schema_view( list=extend_schema( - summary='List encounter methods', - ) + summary="List encounter methods", + ) ) class EncounterMethodResource(PokeapiCommonViewset): queryset = EncounterMethod.objects.all() @@ -242,14 +242,14 @@ class EncounterMethodResource(PokeapiCommonViewset): @extend_schema( - description='Evolution chains are essentially family trees. They start with the lowest stage within a family and detail evolution conditions for each as well as Pokémon they can evolve into up through the hierarchy.', - summary='Get evolution chain', - tags=[ 'evolution' ], - ) + description="Evolution chains are essentially family trees. They start with the lowest stage within a family and detail evolution conditions for each as well as Pokémon they can evolve into up through the hierarchy.", + summary="Get evolution chain", + tags=["evolution"], +) @extend_schema_view( list=extend_schema( - summary='List evolution chains', - ) + summary="List evolution chains", + ) ) class EvolutionChainResource(PokeapiCommonViewset): queryset = EvolutionChain.objects.all() @@ -258,14 +258,14 @@ class EvolutionChainResource(PokeapiCommonViewset): @extend_schema( - description='Evolution triggers are the events and conditions that cause a Pokémon to evolve. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Methods_of_evolution) for greater detail.', - summary='Get evolution trigger', - tags=[ 'evolution' ], - ) + description="Evolution triggers are the events and conditions that cause a Pokémon to evolve. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Methods_of_evolution) for greater detail.", + summary="Get evolution trigger", + tags=["evolution"], +) @extend_schema_view( list=extend_schema( - summary='List evolution triggers', - ) + summary="List evolution triggers", + ) ) class EvolutionTriggerResource(PokeapiCommonViewset): queryset = EvolutionTrigger.objects.all() @@ -274,14 +274,14 @@ class EvolutionTriggerResource(PokeapiCommonViewset): @extend_schema( - description='A generation is a grouping of the Pokémon games that separates them based on the Pokémon they include. In each generation, a new set of Pokémon, Moves, Abilities and Types that did not exist in the previous generation are released.', - summary='Get genration', - tags=[ 'games' ], - ) + description="A generation is a grouping of the Pokémon games that separates them based on the Pokémon they include. In each generation, a new set of Pokémon, Moves, Abilities and Types that did not exist in the previous generation are released.", + summary="Get genration", + tags=["games"], +) @extend_schema_view( list=extend_schema( - summary='List genrations', - ) + summary="List genrations", + ) ) class GenerationResource(PokeapiCommonViewset): queryset = Generation.objects.all() @@ -290,14 +290,14 @@ class GenerationResource(PokeapiCommonViewset): @extend_schema( - description='Genders were introduced in Generation II for the purposes of breeding Pokémon but can also result in visual differences or even different evolutionary lines. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Gender) for greater detail.', - summary='Get gender', - tags=[ 'pokemon' ], - ) + description="Genders were introduced in Generation II for the purposes of breeding Pokémon but can also result in visual differences or even different evolutionary lines. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Gender) for greater detail.", + summary="Get gender", + tags=["pokemon"], +) @extend_schema_view( list=extend_schema( - summary='List genders', - ) + summary="List genders", + ) ) class GenderResource(PokeapiCommonViewset): queryset = Gender.objects.all() @@ -306,14 +306,14 @@ class GenderResource(PokeapiCommonViewset): @extend_schema( - description='Growth rates are the speed with which Pokémon gain levels through experience. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Experience) for greater detail.', - summary='Get growth rate', - tags=[ 'pokemon' ], - ) + description="Growth rates are the speed with which Pokémon gain levels through experience. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Experience) for greater detail.", + summary="Get growth rate", + tags=["pokemon"], +) @extend_schema_view( list=extend_schema( - summary='List growth rates', - ) + summary="List growth rates", + ) ) class GrowthRateResource(PokeapiCommonViewset): queryset = GrowthRate.objects.all() @@ -322,14 +322,14 @@ class GrowthRateResource(PokeapiCommonViewset): @extend_schema( - description='An item is an object in the games which the player can pick up, keep in their bag, and use in some manner. They have various uses, including healing, powering up, helping catch Pokémon, or to access a new area.', - summary='Get item', - tags=[ 'items' ], - ) + description="An item is an object in the games which the player can pick up, keep in their bag, and use in some manner. They have various uses, including healing, powering up, helping catch Pokémon, or to access a new area.", + summary="Get item", + tags=["items"], +) @extend_schema_view( list=extend_schema( - summary='List items', - ) + summary="List items", + ) ) class ItemResource(PokeapiCommonViewset): queryset = Item.objects.all() @@ -338,14 +338,14 @@ class ItemResource(PokeapiCommonViewset): @extend_schema( - description='Item categories determine where items will be placed in the players bag.', - summary='Get item category', - tags=[ 'items' ], - ) + description="Item categories determine where items will be placed in the players bag.", + summary="Get item category", + tags=["items"], +) @extend_schema_view( list=extend_schema( - summary='List item categories', - ) + summary="List item categories", + ) ) class ItemCategoryResource(PokeapiCommonViewset): queryset = ItemCategory.objects.all() @@ -354,14 +354,14 @@ class ItemCategoryResource(PokeapiCommonViewset): @extend_schema( - description='Item attributes define particular aspects of items, e.g."usable in battle" or "consumable".', - summary='Get item attribute', - tags=[ 'items' ], - ) + description='Item attributes define particular aspects of items, e.g."usable in battle" or "consumable".', + summary="Get item attribute", + tags=["items"], +) @extend_schema_view( list=extend_schema( - summary='List item attributes', - ) + summary="List item attributes", + ) ) class ItemAttributeResource(PokeapiCommonViewset): queryset = ItemAttribute.objects.all() @@ -370,14 +370,14 @@ class ItemAttributeResource(PokeapiCommonViewset): @extend_schema( - description='The various effects of the move"Fling" when used with different items.', - summary='Get item fling effect', - tags=[ 'items' ], - ) + description='The various effects of the move"Fling" when used with different items.', + summary="Get item fling effect", + tags=["items"], +) @extend_schema_view( list=extend_schema( - summary='List item fling effects', - ) + summary="List item fling effects", + ) ) class ItemFlingEffectResource(PokeapiCommonViewset): queryset = ItemFlingEffect.objects.all() @@ -386,14 +386,14 @@ class ItemFlingEffectResource(PokeapiCommonViewset): @extend_schema( - description='Pockets within the players bag used for storing items by category.', - summary='Get item pocket', - tags=[ 'items' ], - ) + description="Pockets within the players bag used for storing items by category.", + summary="Get item pocket", + tags=["items"], +) @extend_schema_view( list=extend_schema( - summary='List item pockets', - ) + summary="List item pockets", + ) ) class ItemPocketResource(PokeapiCommonViewset): queryset = ItemPocket.objects.all() @@ -402,14 +402,14 @@ class ItemPocketResource(PokeapiCommonViewset): @extend_schema( - description='Languages for translations of API resource information.', - summary='Get language', - tags=[ 'utility' ], - ) + description="Languages for translations of API resource information.", + summary="Get language", + tags=["utility"], +) @extend_schema_view( list=extend_schema( - summary='List languages', - ) + summary="List languages", + ) ) class LanguageResource(PokeapiCommonViewset): queryset = Language.objects.all() @@ -418,14 +418,14 @@ class LanguageResource(PokeapiCommonViewset): @extend_schema( - description='Locations that can be visited within the games. Locations make up sizable portions of regions, like cities or routes.', - summary='Get location', - tags=[ 'location' ], - ) + description="Locations that can be visited within the games. Locations make up sizable portions of regions, like cities or routes.", + summary="Get location", + tags=["location"], +) @extend_schema_view( list=extend_schema( - summary='List locations', - ) + summary="List locations", + ) ) class LocationResource(PokeapiCommonViewset): queryset = Location.objects.all() @@ -434,14 +434,14 @@ class LocationResource(PokeapiCommonViewset): @extend_schema( - description='Location areas are sections of areas, such as floors in a building or cave. Each area has its own set of possible Pokémon encounters.', - summary='Get location area', - tags=[ 'location' ], - ) + description="Location areas are sections of areas, such as floors in a building or cave. Each area has its own set of possible Pokémon encounters.", + summary="Get location area", + tags=["location"], +) @extend_schema_view( list=extend_schema( - summary='List location areas', - ) + summary="List location areas", + ) ) class LocationAreaResource(ListOrDetailSerialRelation, viewsets.ReadOnlyModelViewSet): queryset = LocationArea.objects.all() @@ -450,14 +450,14 @@ class LocationAreaResource(ListOrDetailSerialRelation, viewsets.ReadOnlyModelVie @extend_schema( - description='Machines are the representation of items that teach moves to Pokémon. They vary from version to version, so it is not certain that one specific TM or HM corresponds to a single Machine.', - summary='Get machine', - tags=[ 'machines' ], - ) + description="Machines are the representation of items that teach moves to Pokémon. They vary from version to version, so it is not certain that one specific TM or HM corresponds to a single Machine.", + summary="Get machine", + tags=["machines"], +) @extend_schema_view( list=extend_schema( - summary='List machines', - ) + summary="List machines", + ) ) class MachineResource(PokeapiCommonViewset): queryset = Machine.objects.all() @@ -466,14 +466,14 @@ class MachineResource(PokeapiCommonViewset): @extend_schema( - description='Moves are the skills of Pokémon in battle. In battle, a Pokémon uses one move each turn. Some moves (including those learned by Hidden Machine) can be used outside of battle as well, usually for the purpose of removing obstacles or exploring new areas.', - summary='Get move', - tags=[ 'moves' ], - ) + description="Moves are the skills of Pokémon in battle. In battle, a Pokémon uses one move each turn. Some moves (including those learned by Hidden Machine) can be used outside of battle as well, usually for the purpose of removing obstacles or exploring new areas.", + summary="Get move", + tags=["moves"], +) @extend_schema_view( list=extend_schema( - summary='List moves', - ) + summary="List moves", + ) ) class MoveResource(PokeapiCommonViewset): queryset = Move.objects.all() @@ -482,14 +482,14 @@ class MoveResource(PokeapiCommonViewset): @extend_schema( - description='Damage classes moves can have, e.g. physical, special, or non-damaging.', - summary='Get move damage class', - tags=[ 'pokemon' ], - ) + description="Damage classes moves can have, e.g. physical, special, or non-damaging.", + summary="Get move damage class", + tags=["pokemon"], +) @extend_schema_view( list=extend_schema( - summary='List move damage classes', - ) + summary="List move damage classes", + ) ) class MoveDamageClassResource(PokeapiCommonViewset): queryset = MoveDamageClass.objects.all() @@ -498,14 +498,14 @@ class MoveDamageClassResource(PokeapiCommonViewset): @extend_schema( - description='Move Ailments are status conditions caused by moves used during battle. See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Status_condition) for greater detail.', - summary='Get move meta ailment', - tags=[ 'moves' ], - ) + description="Move Ailments are status conditions caused by moves used during battle. See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Status_condition) for greater detail.", + summary="Get move meta ailment", + tags=["moves"], +) @extend_schema_view( list=extend_schema( - summary='List move meta ailments', - ) + summary="List move meta ailments", + ) ) class MoveMetaAilmentResource(PokeapiCommonViewset): queryset = MoveMetaAilment.objects.all() @@ -514,14 +514,14 @@ class MoveMetaAilmentResource(PokeapiCommonViewset): @extend_schema( - description='Styles of moves when used in the Battle Palace. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Battle_Frontier_(Generation_III)) for greater detail.', - summary='Get move battle style', - tags=[ 'moves' ], - ) + description="Styles of moves when used in the Battle Palace. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Battle_Frontier_(Generation_III)) for greater detail.", + summary="Get move battle style", + tags=["moves"], +) @extend_schema_view( list=extend_schema( - summary='List move battle styles', - ) + summary="List move battle styles", + ) ) class MoveBattleStyleResource(PokeapiCommonViewset): queryset = MoveBattleStyle.objects.all() @@ -530,14 +530,14 @@ class MoveBattleStyleResource(PokeapiCommonViewset): @extend_schema( - description='Very general categories that loosely group move effects.', - summary='Get move meta category', - tags=[ 'moves' ], - ) + description="Very general categories that loosely group move effects.", + summary="Get move meta category", + tags=["moves"], +) @extend_schema_view( list=extend_schema( - summary='List move meta categories', - ) + summary="List move meta categories", + ) ) class MoveMetaCategoryResource(PokeapiCommonViewset): queryset = MoveMetaCategory.objects.all() @@ -546,14 +546,14 @@ class MoveMetaCategoryResource(PokeapiCommonViewset): @extend_schema( - description='Methods by which Pokémon can learn moves.', - summary='Get move learn method', - tags=[ 'moves' ], - ) + description="Methods by which Pokémon can learn moves.", + summary="Get move learn method", + tags=["moves"], +) @extend_schema_view( list=extend_schema( - summary='List move learn methods', - ) + summary="List move learn methods", + ) ) class MoveLearnMethodResource(PokeapiCommonViewset): queryset = MoveLearnMethod.objects.all() @@ -562,14 +562,14 @@ class MoveLearnMethodResource(PokeapiCommonViewset): @extend_schema( - description='Targets moves can be directed at during battle. Targets can be Pokémon, environments or even other moves.', - summary='Get move target', - tags=[ 'moves' ], - ) + description="Targets moves can be directed at during battle. Targets can be Pokémon, environments or even other moves.", + summary="Get move target", + tags=["moves"], +) @extend_schema_view( list=extend_schema( - summary='List move targets', - ) + summary="List move targets", + ) ) class MoveTargetResource(PokeapiCommonViewset): queryset = MoveTarget.objects.all() @@ -578,14 +578,14 @@ class MoveTargetResource(PokeapiCommonViewset): @extend_schema( - description='Natures influence how a Pokémon\'s stats grow. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Nature) for greater detail.', - summary='Get nature', - tags=[ 'pokemon' ], - ) + description="Natures influence how a Pokémon's stats grow. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Nature) for greater detail.", + summary="Get nature", + tags=["pokemon"], +) @extend_schema_view( list=extend_schema( - summary='List natures', - ) + summary="List natures", + ) ) class NatureResource(PokeapiCommonViewset): queryset = Nature.objects.all() @@ -594,14 +594,14 @@ class NatureResource(PokeapiCommonViewset): @extend_schema( - description='Areas used for grouping Pokémon encounters in Pal Park. They\'re like habitats that are specific to Pal Park.', - summary='Get pal park area', - tags=[ 'location' ], - ) + description="Areas used for grouping Pokémon encounters in Pal Park. They're like habitats that are specific to Pal Park.", + summary="Get pal park area", + tags=["location"], +) @extend_schema_view( list=extend_schema( - summary='List pal park areas', - ) + summary="List pal park areas", + ) ) class PalParkAreaResource(PokeapiCommonViewset): queryset = PalParkArea.objects.all() @@ -610,14 +610,14 @@ class PalParkAreaResource(PokeapiCommonViewset): @extend_schema( - description='Pokeathlon Stats are different attributes of a Pokémon\'s performance in Pokéathlons. In Pokéathlons, competitions happen on different courses; one for each of the different Pokéathlon stats. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9athlon) for greater detail.', - summary='Get pokeathlon stat', - tags=[ 'pokemon' ], - ) + description="Pokeathlon Stats are different attributes of a Pokémon's performance in Pokéathlons. In Pokéathlons, competitions happen on different courses; one for each of the different Pokéathlon stats. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9athlon) for greater detail.", + summary="Get pokeathlon stat", + tags=["pokemon"], +) @extend_schema_view( list=extend_schema( - summary='List pokeathlon stats', - ) + summary="List pokeathlon stats", + ) ) class PokeathlonStatResource(PokeapiCommonViewset): queryset = PokeathlonStat.objects.all() @@ -626,14 +626,14 @@ class PokeathlonStatResource(PokeapiCommonViewset): @extend_schema( - description='A Pokédex is a handheld electronic encyclopedia device; one which is capable of recording and retaining information of the various Pokémon in a given region with the exception of the national dex and some smaller dexes related to portions of a region. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Pokedex) for greater detail.', - summary='Get pokedex', - tags=[ 'games' ], - ) + description="A Pokédex is a handheld electronic encyclopedia device; one which is capable of recording and retaining information of the various Pokémon in a given region with the exception of the national dex and some smaller dexes related to portions of a region. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Pokedex) for greater detail.", + summary="Get pokedex", + tags=["games"], +) @extend_schema_view( list=extend_schema( - summary='List pokedex', - ) + summary="List pokedex", + ) ) class PokedexResource(PokeapiCommonViewset): queryset = Pokedex.objects.all() @@ -642,14 +642,14 @@ class PokedexResource(PokeapiCommonViewset): @extend_schema( - description='Colors used for sorting Pokémon in a Pokédex. The color listed in the Pokédex is usually the color most apparent or covering each Pokémon\'s body. No orange category exists; Pokémon that are primarily orange are listed as red or brown.', - summary='Get pokemon color', - tags=[ 'pokemon' ], - ) + description="Colors used for sorting Pokémon in a Pokédex. The color listed in the Pokédex is usually the color most apparent or covering each Pokémon's body. No orange category exists; Pokémon that are primarily orange are listed as red or brown.", + summary="Get pokemon color", + tags=["pokemon"], +) @extend_schema_view( list=extend_schema( - summary='List pokemon colors', - ) + summary="List pokemon colors", + ) ) class PokemonColorResource(PokeapiCommonViewset): queryset = PokemonColor.objects.all() @@ -658,14 +658,14 @@ class PokemonColorResource(PokeapiCommonViewset): @extend_schema( - description='Some Pokémon may appear in one of multiple, visually different forms. These differences are purely cosmetic. For variations within a Pokémon species, which do differ in more than just visuals, the \'Pokémon\' entity is used to represent such a variety.', - summary='Get pokemon form', - tags=[ 'pokemon' ], - ) + description="Some Pokémon may appear in one of multiple, visually different forms. These differences are purely cosmetic. For variations within a Pokémon species, which do differ in more than just visuals, the 'Pokémon' entity is used to represent such a variety.", + summary="Get pokemon form", + tags=["pokemon"], +) @extend_schema_view( list=extend_schema( - summary='List pokemon forms', - ) + summary="List pokemon forms", + ) ) class PokemonFormResource(PokeapiCommonViewset): queryset = PokemonForm.objects.all() @@ -674,14 +674,14 @@ class PokemonFormResource(PokeapiCommonViewset): @extend_schema( - description='Habitats are generally different terrain Pokémon can be found in but can also be areas designated for rare or legendary Pokémon.', - summary='Get pokemom habita', - tags=[ 'pokemon' ], - ) + description="Habitats are generally different terrain Pokémon can be found in but can also be areas designated for rare or legendary Pokémon.", + summary="Get pokemom habita", + tags=["pokemon"], +) @extend_schema_view( list=extend_schema( - summary='List pokemom habitas', - ) + summary="List pokemom habitas", + ) ) class PokemonHabitatResource(PokeapiCommonViewset): queryset = PokemonHabitat.objects.all() @@ -690,14 +690,14 @@ class PokemonHabitatResource(PokeapiCommonViewset): @extend_schema( - description='Shapes used for sorting Pokémon in a Pokédex.', - summary='Get pokemon shape', - tags=[ 'pokemon' ], - ) + description="Shapes used for sorting Pokémon in a Pokédex.", + summary="Get pokemon shape", + tags=["pokemon"], +) @extend_schema_view( list=extend_schema( - summary='List pokemon shapes', - ) + summary="List pokemon shapes", + ) ) class PokemonShapeResource(PokeapiCommonViewset): queryset = PokemonShape.objects.all() @@ -706,14 +706,14 @@ class PokemonShapeResource(PokeapiCommonViewset): @extend_schema( - description='Pokémon are the creatures that inhabit the world of the Pokémon games. They can be caught using Pokéballs and trained by battling with other Pokémon. Each Pokémon belongs to a specific species but may take on a variant which makes it differ from other Pokémon of the same species, such as base stats, available abilities and typings. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9mon_(species)) for greater detail.', - summary='Get pokemon', - tags=[ 'pokemon' ], - ) + description="Pokémon are the creatures that inhabit the world of the Pokémon games. They can be caught using Pokéballs and trained by battling with other Pokémon. Each Pokémon belongs to a specific species but may take on a variant which makes it differ from other Pokémon of the same species, such as base stats, available abilities and typings. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9mon_(species)) for greater detail.", + summary="Get pokemon", + tags=["pokemon"], +) @extend_schema_view( list=extend_schema( - summary='List pokemon', - ) + summary="List pokemon", + ) ) class PokemonResource(PokeapiCommonViewset): queryset = Pokemon.objects.all() @@ -722,14 +722,14 @@ class PokemonResource(PokeapiCommonViewset): @extend_schema( - description='A Pokémon Species forms the basis for at least one Pokémon. Attributes of a Pokémon species are shared across all varieties of Pokémon within the species. A good example is Wormadam; Wormadam is the species which can be found in three different varieties, Wormadam-Trash, Wormadam-Sandy and Wormadam-Plant.', - summary='Get pokemon species', - tags=[ 'pokemon' ], - ) + description="A Pokémon Species forms the basis for at least one Pokémon. Attributes of a Pokémon species are shared across all varieties of Pokémon within the species. A good example is Wormadam; Wormadam is the species which can be found in three different varieties, Wormadam-Trash, Wormadam-Sandy and Wormadam-Plant.", + summary="Get pokemon species", + tags=["pokemon"], +) @extend_schema_view( list=extend_schema( - summary='List pokemon species', - ) + summary="List pokemon species", + ) ) class PokemonSpeciesResource(PokeapiCommonViewset): queryset = PokemonSpecies.objects.all().order_by("id") @@ -738,14 +738,14 @@ class PokemonSpeciesResource(PokeapiCommonViewset): @extend_schema( - description='A region is an organized area of the Pokémon world. Most often, the main difference between regions is the species of Pokémon that can be encountered within them.', - summary='Get region', - tags=[ 'location' ], - ) + description="A region is an organized area of the Pokémon world. Most often, the main difference between regions is the species of Pokémon that can be encountered within them.", + summary="Get region", + tags=["location"], +) @extend_schema_view( list=extend_schema( - summary='List regions', - ) + summary="List regions", + ) ) class RegionResource(PokeapiCommonViewset): queryset = Region.objects.all() @@ -754,14 +754,14 @@ class RegionResource(PokeapiCommonViewset): @extend_schema( - description='Stats determine certain aspects of battles. Each Pokémon has a value for each stat which grows as they gain levels and can be altered momentarily by effects in battles.', - summary='Get stat', - tags=[ 'pokemon' ], - ) + description="Stats determine certain aspects of battles. Each Pokémon has a value for each stat which grows as they gain levels and can be altered momentarily by effects in battles.", + summary="Get stat", + tags=["pokemon"], +) @extend_schema_view( list=extend_schema( - summary='List stats', - ) + summary="List stats", + ) ) class StatResource(PokeapiCommonViewset): queryset = Stat.objects.all() @@ -770,14 +770,14 @@ class StatResource(PokeapiCommonViewset): @extend_schema( - description='Super contest effects refer to the effects of moves when used in super contests.', - summary='Get super contest effect', - tags=[ 'contests' ], - ) + description="Super contest effects refer to the effects of moves when used in super contests.", + summary="Get super contest effect", + tags=["contests"], +) @extend_schema_view( list=extend_schema( - summary='List super contest effects', - ) + summary="List super contest effects", + ) ) class SuperContestEffectResource(PokeapiCommonViewset): queryset = SuperContestEffect.objects.all() @@ -786,14 +786,14 @@ class SuperContestEffectResource(PokeapiCommonViewset): @extend_schema( - description='Types are properties for Pokémon and their moves. Each type has three properties: which types of Pokémon it is super effective against, which types of Pokémon it is not very effective against, and which types of Pokémon it is completely ineffective against.', - summary='Get types', - tags=[ 'pokemon' ], - ) + description="Types are properties for Pokémon and their moves. Each type has three properties: which types of Pokémon it is super effective against, which types of Pokémon it is not very effective against, and which types of Pokémon it is completely ineffective against.", + summary="Get types", + tags=["pokemon"], +) @extend_schema_view( list=extend_schema( - summary='List types', - ) + summary="List types", + ) ) class TypeResource(PokeapiCommonViewset): queryset = Type.objects.all() @@ -802,14 +802,14 @@ class TypeResource(PokeapiCommonViewset): @extend_schema( - description='Versions of the games, e.g., Red, Blue or Yellow.', - summary='Get version', - tags=[ 'games' ], - ) + description="Versions of the games, e.g., Red, Blue or Yellow.", + summary="Get version", + tags=["games"], +) @extend_schema_view( list=extend_schema( - summary='List versions', - ) + summary="List versions", + ) ) class VersionResource(PokeapiCommonViewset): queryset = Version.objects.all() @@ -818,14 +818,14 @@ class VersionResource(PokeapiCommonViewset): @extend_schema( - description='Version groups categorize highly similar versions of the games.', - summary='Get version group', - tags=[ 'games' ], - ) + description="Version groups categorize highly similar versions of the games.", + summary="Get version group", + tags=["games"], +) @extend_schema_view( list=extend_schema( - summary='List version groups', - ) + summary="List version groups", + ) ) class VersionGroupResource(PokeapiCommonViewset): queryset = VersionGroup.objects.all() @@ -834,128 +834,116 @@ class VersionGroupResource(PokeapiCommonViewset): @extend_schema( - description='Handles Pokemon Encounters as a sub-resource.', - summary='Get pokemon encounter', - tags=[ 'encounters' ], - responses={'200': { - 'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'location_area', 'version_details' ], - 'properties': { - 'location_area': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'cerulean-city-area' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/location-area/281/' - } - } - }, - 'version_details': { - 'type': 'array', - 'items': { - 'type': 'object', - 'required': [ - 'encounter_details', - 'max_chance', - 'version' - ], - 'properties': { - 'encounter_details': { - 'type': 'array', - 'items': { - 'type': 'object', - 'required': [ - 'chance', - 'condition_values', - 'max_level', - 'method', - 'min_level' - ], - 'properties': { - 'chance': { - 'type': 'number', - 'example': 100 - }, - 'condition_values': { - 'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'story-progress-beat-red' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/encounter-condition-value/55/' - } - } - } - }, - 'max_level': { - 'type': 'number', - 'example': 10 - }, - 'method': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'gift' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/encounter-method/18/' - } - } - }, - 'min_level': { - 'type': 'number', - 'example': 10 - } - } - } - }, - 'max_chance': { - 'type': 'number', - 'example': 100 - }, - 'version': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'red' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/version/1/' - } - } - } - } - } - } - } - } - }} - ) + description="Handles Pokemon Encounters as a sub-resource.", + summary="Get pokemon encounter", + tags=["encounters"], + responses={ + "200": { + "type": "array", + "items": { + "type": "object", + "required": ["location_area", "version_details"], + "properties": { + "location_area": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "cerulean-city-area"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/location-area/281/", + }, + }, + }, + "version_details": { + "type": "array", + "items": { + "type": "object", + "required": ["encounter_details", "max_chance", "version"], + "properties": { + "encounter_details": { + "type": "array", + "items": { + "type": "object", + "required": [ + "chance", + "condition_values", + "max_level", + "method", + "min_level", + ], + "properties": { + "chance": { + "type": "number", + "example": 100, + }, + "condition_values": { + "type": "array", + "items": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": { + "type": "string", + "example": "story-progress-beat-red", + }, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/encounter-condition-value/55/", + }, + }, + }, + }, + "max_level": { + "type": "number", + "example": 10, + }, + "method": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": { + "type": "string", + "example": "gift", + }, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/encounter-method/18/", + }, + }, + }, + "min_level": { + "type": "number", + "example": 10, + }, + }, + }, + }, + "max_chance": {"type": "number", "example": 100}, + "version": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "red"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/version/1/", + }, + }, + }, + }, + }, + }, + }, + }, + } + }, +) class PokemonEncounterView(APIView): - def get(self, request, pokemon_id): self.context = dict(request=request) diff --git a/pokemon_v2/serializers.py b/pokemon_v2/serializers.py index fd4db0228..463b60f41 100644 --- a/pokemon_v2/serializers.py +++ b/pokemon_v2/serializers.py @@ -478,12 +478,15 @@ class Meta: "descriptions", ) - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'number', - }, - 'example': [ 0, 5, 10, 15, 20, 25, 30 ] - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "number", + }, + "example": [0, 5, 10, 15, 20, 25, 30], + } + ) def get_values(self, obj): mod = obj.gene_mod_5 values = [] @@ -616,23 +619,23 @@ class Meta: "version_groups", ) - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'red-blue' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/version-group/1/' - } - } - } - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "red-blue"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/version-group/1/", + }, + }, + }, + } + ) def get_region_version_groups(self, obj): vg_regions = VersionGroupRegion.objects.filter(region=obj) data = VersionGroupRegionSerializer( @@ -700,33 +703,30 @@ class Meta: model = Gender fields = ("id", "name", "pokemon_species_details", "required_for_evolution") - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'rate', 'pokemon_species' ], - 'properties': { - 'rate': { - 'type': 'number', - 'example': 1 - }, - 'pokemon_species': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'bulbasaur' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/pokemon-species/1/' - } - } - } - } - } - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["rate", "pokemon_species"], + "properties": { + "rate": {"type": "number", "example": 1}, + "pokemon_species": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "bulbasaur"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/pokemon-species/1/", + }, + }, + }, + }, + }, + } + ) def get_species(self, obj): species_objects = [] @@ -749,23 +749,23 @@ def get_species(self, obj): return details - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'wormadam' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/pokemon-species/413/' - } - } - } - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "wormadam"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/pokemon-species/413/", + }, + }, + }, + } + ) def get_required(self, obj): evo_objects = PokemonEvolution.objects.filter(gender=obj) species_list = [] @@ -975,57 +975,54 @@ class Meta: "pokemon_encounters", ) - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'encounter_method', 'version_details' ], - 'properties': { - 'encounter_method': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'old-rod' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/encounter-method/2/' - } - } - }, - 'version_details': { - 'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'rate', 'version' ], - 'properties': { - 'rate': { - 'type': 'number', - 'example': 5 - }, - 'version': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'platinum' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/version/14/' - } - } - } - } - } - } - } - } - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["encounter_method", "version_details"], + "properties": { + "encounter_method": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "old-rod"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/encounter-method/2/", + }, + }, + }, + "version_details": { + "type": "array", + "items": { + "type": "object", + "required": ["rate", "version"], + "properties": { + "rate": {"type": "number", "example": 5}, + "version": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": { + "type": "string", + "example": "platinum", + }, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/version/14/", + }, + }, + }, + }, + }, + }, + }, + }, + } + ) def get_method_rates(self, obj): # Get encounters related to this area and pull out unique encounter methods encounter_rates = LocationAreaEncounterRate.objects.filter( @@ -1067,111 +1064,99 @@ def get_method_rates(self, obj): return encounter_rate_list - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'pokemon', 'version_details' ], - 'properties': { - 'pokemon': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'tentacool' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'ttps://pokeapi.co/api/v2/pokemon/72/' - } - } - }, - 'version_details': { - 'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'version', 'max_chance', 'encounter_details' ], - 'properties': { - 'version': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'diamond' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/version/12/' - } - } - }, - 'max_chance': { - 'type': 'number', - 'example': 60 - }, - 'encounter_details': { - 'type': 'object', - 'required': [ - 'min_level', - 'max_level', - 'condition_value', - 'chance', - 'method' - ], - 'properties': { - 'min_level': { - 'type': 'number', - 'example': 20 - }, - 'max_level': { - 'type': 'number', - 'example': 30 - }, - 'condition_values': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'slot2-sapphire' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/encounter-condition-value/10/' - } - } - }, - 'chance': { - 'type': 'number', - 'example': 60 - }, - 'method': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'surf' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/encounter-method/5/' - } - } - } - } - } - } - } - } - } - } - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["pokemon", "version_details"], + "properties": { + "pokemon": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "tentacool"}, + "url": { + "type": "string", + "format": "uri", + "example": "ttps://pokeapi.co/api/v2/pokemon/72/", + }, + }, + }, + "version_details": { + "type": "array", + "items": { + "type": "object", + "required": ["version", "max_chance", "encounter_details"], + "properties": { + "version": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": { + "type": "string", + "example": "diamond", + }, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/version/12/", + }, + }, + }, + "max_chance": {"type": "number", "example": 60}, + "encounter_details": { + "type": "object", + "required": [ + "min_level", + "max_level", + "condition_value", + "chance", + "method", + ], + "properties": { + "min_level": {"type": "number", "example": 20}, + "max_level": {"type": "number", "example": 30}, + "condition_values": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": { + "type": "string", + "example": "slot2-sapphire", + }, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/encounter-condition-value/10/", + }, + }, + }, + "chance": {"type": "number", "example": 60}, + "method": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": { + "type": "string", + "example": "surf", + }, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/encounter-method/5/", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + } + ) def get_encounters(self, obj): # get versions for later use version_objects = Version.objects.all() @@ -1343,37 +1328,31 @@ class Meta: "pokemon", ) - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'is_hidden', 'slot', 'pokemon' ], - 'properties': { - 'is_hidden': { - 'type': 'boolean', - 'example': True - }, - 'slot': { - 'type': 'number', - 'example': 3 - }, - 'pokemon': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'gloom' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/pokemon/44/' - } - } - } - } - } - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["is_hidden", "slot", "pokemon"], + "properties": { + "is_hidden": {"type": "boolean", "example": True}, + "slot": {"type": "number", "example": 3}, + "pokemon": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "gloom"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/pokemon/44/", + }, + }, + }, + }, + }, + } + ) def get_ability_pokemon(self, obj): pokemon_ability_objects = PokemonAbility.objects.filter(ability=obj) data = PokemonAbilitySerializer( @@ -1424,67 +1403,61 @@ class Meta: "names", ) - @extend_schema_field(field={'type': 'object', - 'required': [ 'decrease', 'increase' ], - 'properties': { - 'increase': { - 'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'change', 'move' ], - 'properties': { - 'change': { - 'type': 'number', - 'example': -1 - }, - 'move': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'swords-dance' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/move/14/' - } - } - } - } - } - }, - 'decrease': { - 'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'change', 'move' ], - 'properties': { - 'change': { - 'type': 'number', - 'example': 5 - }, - 'move': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'growl' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/move/45/' - } - } - } - } - } - } - } - }) + @extend_schema_field( + field={ + "type": "object", + "required": ["decrease", "increase"], + "properties": { + "increase": { + "type": "array", + "items": { + "type": "object", + "required": ["change", "move"], + "properties": { + "change": {"type": "number", "example": -1}, + "move": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": { + "type": "string", + "example": "swords-dance", + }, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/move/14/", + }, + }, + }, + }, + }, + }, + "decrease": { + "type": "array", + "items": { + "type": "object", + "required": ["change", "move"], + "properties": { + "change": {"type": "number", "example": 5}, + "move": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "growl"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/move/45/", + }, + }, + }, + }, + }, + }, + }, + } + ) def get_moves_that_affect(self, obj): stat_change_objects = MoveMetaStatChange.objects.filter(stat=obj) stat_changes = MoveMetaStatChangeSerializer( @@ -1501,47 +1474,44 @@ def get_moves_that_affect(self, obj): return changes - @extend_schema_field(field={'type': 'object', - 'required': [ 'increase', 'decrease' ], - 'properties': { - 'increase': { - 'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'lonely' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/nature/6/' - } - } - } - }, - 'decrease': { - 'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'bold' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/nature/2/' - } - } - } - }, - } - }) + @extend_schema_field( + field={ + "type": "object", + "required": ["increase", "decrease"], + "properties": { + "increase": { + "type": "array", + "items": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "lonely"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/nature/6/", + }, + }, + }, + }, + "decrease": { + "type": "array", + "items": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "bold"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/nature/2/", + }, + }, + }, + }, + }, + } + ) def get_natures_that_affect(self, obj): increase_objects = Nature.objects.filter(increased_stat=obj) increases = NatureSummarySerializer( @@ -1636,23 +1606,23 @@ class Meta: model = ItemAttribute fields = ("id", "name", "descriptions", "items", "names") - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'master-ball' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/item/1/' - } - } - } - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "master-ball"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/item/1/", + }, + }, + }, + } + ) def get_attribute_items(self, obj): item_map_objects = ItemAttributeMap.objects.filter(item_attribute=obj) items = [] @@ -1769,34 +1739,34 @@ class Meta: "machines", ) - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'machine', 'version_group' ], - 'properties': { - 'machine': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/machine/1/' - }, - 'version_group': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'sword-shield' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/version-group/20/' - } - } - } - } - } - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["machine", "version_group"], + "properties": { + "machine": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/machine/1/", + }, + "version_group": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "sword-shield"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/version-group/20/", + }, + }, + }, + }, + }, + } + ) def get_item_machines(self, obj): machine_objects = Machine.objects.filter(item=obj) @@ -1817,37 +1787,40 @@ def get_item_machines(self, obj): return machines - @extend_schema_field(field={'type': 'object', - 'required': [ 'default' ], - 'properties': { - 'default': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/media/sprites/items/master-ball.png' - } - } - }) + @extend_schema_field( + field={ + "type": "object", + "required": ["default"], + "properties": { + "default": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/media/sprites/items/master-ball.png", + } + }, + } + ) def get_item_sprites(self, obj): sprites_object = ItemSprites.objects.get(item_id=obj) return sprites_object.sprites - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'countable' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/item-attribute/1/' - } - } - } - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "countable"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/item-attribute/1/", + }, + }, + }, + } + ) def get_item_attributes(self, obj): item_attribute_maps = ItemAttributeMap.objects.filter(item=obj) serializer = ItemAttributeMapSerializer( @@ -1865,57 +1838,51 @@ def get_item_attributes(self, obj): return attributes - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'pokemon', 'version-details' ], - 'properties': { - 'pokemon': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'farfetchd' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/pokemon/83/' - } - } - }, - 'version-details': { - 'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'rarity', 'version' ], - 'properties': { - 'rarity': { - 'type': 'number', - 'example': 5 - }, - 'version': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'ruby' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/version/7/' - } - } - } - } - } - } - } - } - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["pokemon", "version-details"], + "properties": { + "pokemon": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "farfetchd"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/pokemon/83/", + }, + }, + }, + "version-details": { + "type": "array", + "items": { + "type": "object", + "required": ["rarity", "version"], + "properties": { + "rarity": {"type": "number", "example": 5}, + "version": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "ruby"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/version/7/", + }, + }, + }, + }, + }, + }, + }, + }, + } + ) def get_held_by_pokemon(self, obj): pokemon_items = PokemonItem.objects.filter(item=obj).order_by("pokemon_id") pokemon_ids = pokemon_items.values("pokemon_id").distinct() @@ -1948,16 +1915,19 @@ def get_held_by_pokemon(self, obj): return pokemon_list - @extend_schema_field(field={'type': 'object', - 'required': [ 'url' ], - 'properties': { - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': '"https://pokeapi.co/api/v2/evolution-chain/51/' - } - } - }) + @extend_schema_field( + field={ + "type": "object", + "required": ["url"], + "properties": { + "url": { + "type": "string", + "format": "uri", + "example": '"https://pokeapi.co/api/v2/evolution-chain/51/', + } + }, + } + ) def get_baby_trigger_for(self, obj): try: chain_object = EvolutionChain.objects.get(baby_trigger_item=obj) @@ -2022,33 +1992,30 @@ class Meta: "names", ) - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'max_change', 'pokeathlon_stat' ], - 'properties': { - 'max_change': { - 'type': 'number', - 'example': 1 - }, - 'pokeathlon_stat': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'power' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/pokeathlon-stat/2/' - } - } - } - } - } - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["max_change", "pokeathlon_stat"], + "properties": { + "max_change": {"type": "number", "example": 1}, + "pokeathlon_stat": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "power"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/pokeathlon-stat/2/", + }, + }, + }, + }, + }, + } + ) def get_pokeathlon_stats(self, obj): pokeathlon_stat_objects = NaturePokeathlonStat.objects.filter(nature=obj) pokeathlon_stats = NaturePokeathlonStatSerializer( @@ -2104,35 +2071,35 @@ class Meta: model = BerryFlavor fields = ("id", "name", "berries", "contest_type", "names") - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'potency', 'berry' ], - 'properties': { - 'potency': { - 'type': 'integer', - 'example': 10 - }, - 'berry': { - 'type': 'object', - 'require': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'description': 'The name of the berry', - 'example': 'rowap' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'description': 'The URL to get more information about the berry', - 'example': 'https://pokeapi.co/api/v2/berry/64/' - } - } - } - } - }, - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["potency", "berry"], + "properties": { + "potency": {"type": "integer", "example": 10}, + "berry": { + "type": "object", + "require": ["name", "url"], + "properties": { + "name": { + "type": "string", + "description": "The name of the berry", + "example": "rowap", + }, + "url": { + "type": "string", + "format": "uri", + "description": "The URL to get more information about the berry", + "example": "https://pokeapi.co/api/v2/berry/64/", + }, + }, + }, + }, + }, + } + ) def get_berries_with_flavor(self, obj): flavor_map_objects = BerryFlavorMap.objects.filter( berry_flavor=obj, potency__gt=0 @@ -2170,35 +2137,35 @@ class Meta: "natural_gift_type", ) - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'potency', 'flavor' ], - 'properties': { - 'potency': { - 'type': 'integer', - 'example': 10 - }, - 'flavor': { - 'type': 'object', - 'require': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'description': 'The name of the flavor', - 'example': 'spicy' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'description': 'The URL to get more information about the flavor', - 'example': 'https://pokeapi.co/api/v2/berry-flavor/1/' - } - } - } - } - }, - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["potency", "flavor"], + "properties": { + "potency": {"type": "integer", "example": 10}, + "flavor": { + "type": "object", + "require": ["name", "url"], + "properties": { + "name": { + "type": "string", + "description": "The name of the flavor", + "example": "spicy", + }, + "url": { + "type": "string", + "format": "uri", + "description": "The URL to get more information about the flavor", + "example": "https://pokeapi.co/api/v2/berry-flavor/1/", + }, + }, + }, + }, + }, + } + ) def get_berry_flavors(self, obj): flavor_map_objects = BerryFlavorMap.objects.filter(berry=obj) flavor_maps = BerryFlavorMapSerializer( @@ -2241,25 +2208,28 @@ class Meta: model = EggGroup fields = ("id", "name", "names", "pokemon_species") - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'potency', 'flavor' ], - 'properties': { - 'name': { - 'type': 'string', - 'description': 'Pokemon species name.', - 'example': 'bulbasaur' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'description': 'The URL to get more information about the species', - 'example': 'https://pokeapi.co/api/v2/pokemon-species/1/' - }, - } - }, - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["potency", "flavor"], + "properties": { + "name": { + "type": "string", + "description": "Pokemon species name.", + "example": "bulbasaur", + }, + "url": { + "type": "string", + "format": "uri", + "description": "The URL to get more information about the species", + "example": "https://pokeapi.co/api/v2/pokemon-species/1/", + }, + }, + }, + } + ) def get_species(self, obj): results = PokemonEggGroup.objects.filter(egg_group=obj) data = PokemonEggGroupSerializer(results, many=True, context=self.context).data @@ -2354,126 +2324,111 @@ def add_type_entry(self, relations, type, damage_factor, direction="_damage_to") TypeSummarySerializer(type, context=self.context).data ) - @extend_schema_field(field={'type': 'object', - 'required': [ - 'no_damage_to', - 'half_damage_to', - 'double_damage_to', - 'no_damage_from', - 'half_damage_from', - 'double_damage_from' - ], - 'properties': { - 'no_damage_to': { - 'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'flying' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/type/3/' - } - } - } - }, - 'half_damage_to': { - 'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'bug' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/type/7/' - } - } - } - }, - 'double_damage_to': { - 'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'poison' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/type/4/' - } - } - } - }, - 'no_damage_from': { - 'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'electric' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/type/13/' - } - } - } - }, - 'half_damage_from': { - 'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'poison' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/type/4/' - } - } - } - }, - 'double_damage_from': { - 'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'water' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/type/11/' - } - } - } - } - } - }) + @extend_schema_field( + field={ + "type": "object", + "required": [ + "no_damage_to", + "half_damage_to", + "double_damage_to", + "no_damage_from", + "half_damage_from", + "double_damage_from", + ], + "properties": { + "no_damage_to": { + "type": "array", + "items": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "flying"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/type/3/", + }, + }, + }, + }, + "half_damage_to": { + "type": "array", + "items": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "bug"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/type/7/", + }, + }, + }, + }, + "double_damage_to": { + "type": "array", + "items": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "poison"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/type/4/", + }, + }, + }, + }, + "no_damage_from": { + "type": "array", + "items": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "electric"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/type/13/", + }, + }, + }, + }, + "half_damage_from": { + "type": "array", + "items": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "poison"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/type/4/", + }, + }, + }, + }, + "double_damage_from": { + "type": "array", + "items": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "water"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/type/11/", + }, + }, + }, + }, + }, + } + ) def get_type_relationships(self, obj): relations = OrderedDict() relations["no_damage_to"] = [] @@ -2538,150 +2493,135 @@ def remove_type_entry(self, relations, type, direction="_damage_to"): return # returns past type relationships for the given type object - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'generation', 'damage_relations' ], - 'properties': { - 'generation': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'generation-v' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/generation/5/' - } - } - }, - 'damage_relations': { - 'type': 'object', - 'required': [ - 'no_damage_to', - 'half_damage_to', - 'double_damage_to', - 'no_damage_from', - 'half_damage_from', - 'double_damage_from' - ], - 'properties': { - 'no_damage_to': { - 'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'flying' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/type/3/' - } - } - } - }, - 'half_damage_to': { - 'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'bug' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/type/7/' - } - } - } - }, - 'double_damage_to': { - 'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'poison' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/type/4/' - } - } - } - }, - 'no_damage_from': { - 'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'electric' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/type/13/' - } - } - } - }, - 'half_damage_from': { - 'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'poison' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/type/4/' - } - } - } - }, - 'double_damage_from': { - 'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'water' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/type/11/' - } - } - } - } - } - } - } - }, - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["generation", "damage_relations"], + "properties": { + "generation": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "generation-v"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/generation/5/", + }, + }, + }, + "damage_relations": { + "type": "object", + "required": [ + "no_damage_to", + "half_damage_to", + "double_damage_to", + "no_damage_from", + "half_damage_from", + "double_damage_from", + ], + "properties": { + "no_damage_to": { + "type": "array", + "items": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "flying"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/type/3/", + }, + }, + }, + }, + "half_damage_to": { + "type": "array", + "items": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "bug"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/type/7/", + }, + }, + }, + }, + "double_damage_to": { + "type": "array", + "items": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "poison"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/type/4/", + }, + }, + }, + }, + "no_damage_from": { + "type": "array", + "items": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": { + "type": "string", + "example": "electric", + }, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/type/13/", + }, + }, + }, + }, + "half_damage_from": { + "type": "array", + "items": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "poison"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/type/4/", + }, + }, + }, + }, + "double_damage_from": { + "type": "array", + "items": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "water"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/type/11/", + }, + }, + }, + }, + }, + }, + }, + }, + } + ) def get_type_past_relationships(self, obj): # collect data from DB damage_type_results = list(TypeEfficacyPast.objects.filter(damage_type=obj)) @@ -2776,35 +2716,35 @@ def type_is_present(self, type, current_gen): gen_introduced = Generation.objects.get(pk=type_obj.generation.id) return gen_introduced.id <= current_gen.id - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'potency', 'flavor' ], - 'properties': { - 'slot': { - 'type': 'integer', - 'example': 1 - }, - 'pokemon': { - 'type': 'object', - 'require': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'description': 'The name of the pokemon', - 'example': 'sandshrew' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'description': 'The URL to get more information about the pokemon', - 'example': 'https://pokeapi.co/api/v2/pokemon/27/' - } - } - } - } - }, - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["potency", "flavor"], + "properties": { + "slot": {"type": "integer", "example": 1}, + "pokemon": { + "type": "object", + "require": ["name", "url"], + "properties": { + "name": { + "type": "string", + "description": "The name of the pokemon", + "example": "sandshrew", + }, + "url": { + "type": "string", + "format": "uri", + "description": "The URL to get more information about the pokemon", + "example": "https://pokeapi.co/api/v2/pokemon/27/", + }, + }, + }, + }, + }, + } + ) def get_type_pokemon(self, obj): poke_type_objects = PokemonType.objects.filter(type=obj) poke_types = PokemonTypeSerializer( @@ -2911,23 +2851,23 @@ class Meta: model = MoveMetaAilment fields = ("id", "name", "moves", "names") - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'thunder-punch' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/move/9/' - } - } - }, - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "thunder-punch"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/move/9/", + }, + }, + }, + } + ) def get_ailment_moves(self, obj): move_meta_objects = MoveMeta.objects.filter(move_meta_ailment=obj) moves = [] @@ -2958,23 +2898,23 @@ class Meta: model = MoveMetaCategory fields = ("id", "name", "descriptions", "moves") - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'sing' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/move/47/' - } - } - }, - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "sing"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/move/47/", + }, + }, + }, + } + ) def get_category_moves(self, obj): move_meta_objects = MoveMeta.objects.filter(move_meta_category=obj) moves = [] @@ -3069,37 +3009,37 @@ class Meta: "version_group", ) - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'effect', 'short_effect', 'language' ], - 'properties': { - 'effect': { - 'type': 'string', - 'example': 'Inflicts [regular damage]{mechanic:regular-damage}.' - }, - 'short_effect': { - 'type': 'string', - 'example': 'Inflicts regular damage with no additional effect.' - }, - 'language': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'en' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/language/9/' - } - } - } - }, - }, - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["effect", "short_effect", "language"], + "properties": { + "effect": { + "type": "string", + "example": "Inflicts [regular damage]{mechanic:regular-damage}.", + }, + "short_effect": { + "type": "string", + "example": "Inflicts regular damage with no additional effect.", + }, + "language": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "en"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/language/9/", + }, + }, + }, + }, + }, + } + ) def get_effects(self, obj): effect_texts = MoveEffectEffectText.objects.filter(move_effect=obj.move_effect) data = MoveEffectEffectTextSerializer( @@ -3197,23 +3137,23 @@ class Meta: "learned_by_pokemon", ) - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'clefairy' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/pokemon/35/' - } - } - }, - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "clefairy"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/pokemon/35/", + }, + }, + }, + } + ) def get_learned_by_pokemon(self, obj): pokemon_moves = PokemonMove.objects.filter(move_id=obj).order_by("pokemon_id") @@ -3231,40 +3171,40 @@ def get_learned_by_pokemon(self, obj): return pokemon_list - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'machine', 'version_group' ], - 'properties': { - 'machine': { - 'type': 'object', - 'required': [ 'url' ], - 'properties': { - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/machine/1/' - } - } - }, - 'version_group': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'sword-shield' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/version-group/1/' - } - } - } - } - }, - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["machine", "version_group"], + "properties": { + "machine": { + "type": "object", + "required": ["url"], + "properties": { + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/machine/1/", + } + }, + }, + "version_group": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "sword-shield"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/version-group/1/", + }, + }, + }, + }, + }, + } + ) def get_move_machines(self, obj): machine_objects = Machine.objects.filter(move=obj) @@ -3285,99 +3225,96 @@ def get_move_machines(self, obj): return machines - @extend_schema_field(field={'type': 'object', - 'properties': { - 'required': [ 'normal', 'super' ], - 'normal': { - 'type': 'object', - 'required': [ 'use_before', 'use_after' ], - 'properties': { - 'use_before': { - 'type': 'array', - 'nullable': True, - 'items': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'fire-punch' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/move/7/' - } - } - } - }, - 'use_after': { - 'type': 'array', - 'nullable': True, - 'items': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'ice-punch' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/move/8/' - } - } - } - } - } - }, - 'super': { - 'type': 'object', - 'required': [ 'use_before', 'use_after' ], - 'properties': { - 'use_before': { - 'type': 'array', - 'nullable': True, - 'items': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'night-slash' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/move/400/' - } - } - } - }, - 'use_after': { - 'type': 'array', - 'nullable': True, - 'items': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'focus-energy' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/move/116/' - } - } - } - } - } - }, - }, - }) + @extend_schema_field( + field={ + "type": "object", + "properties": { + "required": ["normal", "super"], + "normal": { + "type": "object", + "required": ["use_before", "use_after"], + "properties": { + "use_before": { + "type": "array", + "nullable": True, + "items": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "fire-punch"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/move/7/", + }, + }, + }, + }, + "use_after": { + "type": "array", + "nullable": True, + "items": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "ice-punch"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/move/8/", + }, + }, + }, + }, + }, + }, + "super": { + "type": "object", + "required": ["use_before", "use_after"], + "properties": { + "use_before": { + "type": "array", + "nullable": True, + "items": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": { + "type": "string", + "example": "night-slash", + }, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/move/400/", + }, + }, + }, + }, + "use_after": { + "type": "array", + "nullable": True, + "items": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": { + "type": "string", + "example": "focus-energy", + }, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/move/116/", + }, + }, + }, + }, + }, + }, + }, + } + ) def get_combos(self, obj): normal_before_objects = ContestCombo.objects.filter(first_move=obj) normal_before_data = ContestComboSerializer( @@ -3435,37 +3372,37 @@ def get_combos(self, obj): return details - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'effect', 'short_effect', 'language' ], - 'properties': { - 'effect': { - 'type': 'string', - 'example': 'Inflicts [regular damage]{mechanic:regular-damage}.' - }, - 'short_effect': { - 'type': 'string', - 'example': 'Inflicts regular damage with no additional effect.' - }, - 'language': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'en' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/language/9/' - } - } - } - }, - }, - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["effect", "short_effect", "language"], + "properties": { + "effect": { + "type": "string", + "example": "Inflicts [regular damage]{mechanic:regular-damage}.", + }, + "short_effect": { + "type": "string", + "example": "Inflicts regular damage with no additional effect.", + }, + "language": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "en"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/language/9/", + }, + }, + }, + }, + }, + } + ) def get_effect_text(self, obj): effect_texts = MoveEffectEffectText.objects.filter(move_effect=obj.move_effect) data = MoveEffectEffectTextSerializer( @@ -3480,57 +3417,54 @@ def get_effect_text(self, obj): return data - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'effect_entries', 'version_group' ], - 'properties': { - 'effect_entries': { - 'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'effect', 'language' ], - 'properties': { - 'effect': { - 'type': 'string', - 'example': 'Hits Pokémon under the effects of dig and fly.' - }, - 'language': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'en' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/language/9/' - } - } - } - } - } - }, - 'version_group': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'gold-silver' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/version-group/3/' - } - } - } - } - } - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["effect_entries", "version_group"], + "properties": { + "effect_entries": { + "type": "array", + "items": { + "type": "object", + "required": ["effect", "language"], + "properties": { + "effect": { + "type": "string", + "example": "Hits Pokémon under the effects of dig and fly.", + }, + "language": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "en"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/language/9/", + }, + }, + }, + }, + }, + }, + "version_group": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "gold-silver"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/version-group/3/", + }, + }, + }, + }, + }, + } + ) def get_effect_change_text(self, obj): effect_changes = MoveEffectChange.objects.filter(move_effect=obj.move_effect) data = MoveEffectChangeSerializer( @@ -3539,33 +3473,30 @@ def get_effect_change_text(self, obj): return data - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'change', 'stat' ], - 'properties': { - 'change': { - 'type': 'number', - 'example': 2 - }, - 'stat': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'attack' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/stat/1/' - } - } - } - } - } - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["change", "stat"], + "properties": { + "change": {"type": "number", "example": 2}, + "stat": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "attack"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/stat/1/", + }, + }, + }, + }, + }, + } + ) def get_move_stat_change(self, obj): stat_change_objects = MoveMetaStatChange.objects.filter(move=obj) stat_changes = MoveMetaStatChangeSerializer( @@ -3610,37 +3541,31 @@ class Meta: model = PalParkArea fields = ("id", "name", "names", "pokemon_encounters") - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'base_score', 'pokemon-species', 'rate' ], - 'properties': { - 'base_score': { - 'type': 'number', - 'example': 50 - }, - 'pokemon-species': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'bulbasaur' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/pokemon-species/1/' - } - } - }, - 'rate': { - 'type': 'number', - 'example': 30 - }, - } - } - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["base_score", "pokemon-species", "rate"], + "properties": { + "base_score": {"type": "number", "example": 50}, + "pokemon-species": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "bulbasaur"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/pokemon-species/1/", + }, + }, + }, + "rate": {"type": "number", "example": 30}, + }, + }, + } + ) def get_encounters(self, obj): pal_park_objects = PalPark.objects.filter(pal_park_area=obj) parks = PalParkSerializer( @@ -3725,33 +3650,30 @@ class Meta: "types", ) - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'language', 'name' ], - 'properties': { - 'language': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'en' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/language/9/' - } - } - }, - 'name': { - 'type': 'string', - 'example': 'Plant Cloak' - } - } - } - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["language", "name"], + "properties": { + "language": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "en"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/language/9/", + }, + }, + }, + "name": {"type": "string", "example": "Plant Cloak"}, + }, + }, + } + ) def get_pokemon_form_names(self, obj): form_results = PokemonFormName.objects.filter( pokemon_form=obj, name__regex=".+" @@ -3767,33 +3689,30 @@ def get_pokemon_form_names(self, obj): return data - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'language', 'name' ], - 'properties': { - 'language': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'en' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/language/9/' - } - } - }, - 'name': { - 'type': 'string', - 'example': 'Plant Cloak' - } - } - } - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["language", "name"], + "properties": { + "language": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "en"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/language/9/", + }, + }, + }, + "name": {"type": "string", "example": "Plant Cloak"}, + }, + }, + } + ) def get_pokemon_form_pokemon_names(self, obj): form_results = PokemonFormName.objects.filter( pokemon_form=obj, pokemon_name__regex=".+" @@ -3810,62 +3729,62 @@ def get_pokemon_form_pokemon_names(self, obj): return data - @extend_schema_field(field={'type': 'object', - 'properties': { - 'default': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/412.png', - } - }, - 'additionalProperties': { # Stoplight Elements doesn't render this well - 'type': 'string', - 'format': 'uri', - 'nullable': True, - 'example': 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/412.png' - }, - 'example': { - 'back_default': 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/412.png', - 'back_female': None, - 'back_shiny': 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/412.png', - 'back_shiny_female': None, - 'front_default': 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/412.png', - 'front_female': None, - 'front_shiny': 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/shiny/412.png', - 'front_shiny_female': None - } - }) + @extend_schema_field( + field={ + "type": "object", + "properties": { + "default": { + "type": "string", + "format": "uri", + "example": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/412.png", + } + }, + "additionalProperties": { # Stoplight Elements doesn't render this well + "type": "string", + "format": "uri", + "nullable": True, + "example": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/412.png", + }, + "example": { + "back_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/412.png", + "back_female": None, + "back_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/412.png", + "back_shiny_female": None, + "front_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/412.png", + "front_female": None, + "front_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/shiny/412.png", + "front_shiny_female": None, + }, + } + ) def get_pokemon_form_sprites(self, obj): sprites_object = PokemonFormSprites.objects.get(pokemon_form_id=obj) return sprites_object.sprites - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'slot', 'type' ], - 'properties': { - 'slot': { - 'type': 'number', - 'example': 1 - }, - 'type': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'bug' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/type/7/' - } - } - }, - } - } - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["slot", "type"], + "properties": { + "slot": {"type": "number", "example": 1}, + "type": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "bug"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/type/7/", + }, + }, + }, + }, + }, + } + ) def get_pokemon_form_types(self, obj): form_type_objects = PokemonFormType.objects.filter(pokemon_form=obj) form_types = PokemonFormTypeSerializer( @@ -3949,28 +3868,29 @@ class Meta: model = MoveLearnMethod fields = ("id", "name", "names", "descriptions", "version_groups") - # "version_groups": [ - # { - # "name": "red-blue", - # "url": "https://pokeapi.co/api/v2/version-group/1/" - # }, - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'red-blue' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/version-group/1/' - } - } - } - }) + # "version_groups": [ + # { + # "name": "red-blue", + # "url": "https://pokeapi.co/api/v2/version-group/1/" + # }, + + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "red-blue"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/version-group/1/", + }, + }, + }, + } + ) def get_method_version_groups(self, obj): version_group_objects = VersionGroupMoveLearnMethod.objects.filter( move_learn_method=obj @@ -4015,23 +3935,23 @@ class Meta: model = PokemonShape fields = ("id", "name", "awesome_names", "names", "pokemon_species") - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'url', 'name' ], - 'properties': { - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/language/9/' - }, - 'name': { - 'type': 'string', - 'example': 'Ball' - } - } - } - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["url", "name"], + "properties": { + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/language/9/", + }, + "name": {"type": "string", "example": "Ball"}, + }, + }, + } + ) def get_shape_names(self, obj): results = PokemonShapeName.objects.filter(pokemon_shape_id=obj) serializer = PokemonShapeNameSerializer( @@ -4044,49 +3964,46 @@ def get_shape_names(self, obj): return data - # "awesome_names": [ - # { - # "awesome_name": "Pomacé", - # "language": { - # "name": "fr", - # "url": "https://pokeapi.co/api/v2/language/5/" - # } - # }, - # { - # "awesome_name": "Pomaceous", - # "language": { - # "name": "en", - # "url": "https://pokeapi.co/api/v2/language/9/" - # } - # } - # ], - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'awesome_name', 'language' ], - 'properties': { - 'awesome_name': { - 'type': 'string', - 'example': 'Pomaceous' - }, - 'language': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'en' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/language/9/' - } - } - } - } - } - }) + # "awesome_names": [ + # { + # "awesome_name": "Pomacé", + # "language": { + # "name": "fr", + # "url": "https://pokeapi.co/api/v2/language/5/" + # } + # }, + # { + # "awesome_name": "Pomaceous", + # "language": { + # "name": "en", + # "url": "https://pokeapi.co/api/v2/language/9/" + # } + # } + # ], + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["awesome_name", "language"], + "properties": { + "awesome_name": {"type": "string", "example": "Pomaceous"}, + "language": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "en"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/language/9/", + }, + }, + }, + }, + }, + } + ) def get_shape_awesome_names(self, obj): results = PokemonShapeName.objects.filter(pokemon_shape_id=obj) serializer = PokemonShapeNameSerializer( @@ -4180,50 +4097,56 @@ class Meta: "past_types", ) - @extend_schema_field(field={'type': 'object', - 'properties': { - 'front_default': { - 'type': 'string', - 'format': 'uri', - 'exmaple': 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/1.png', - } - }, - 'additionalProperties': { # Stoplight Elements doesn't render this well - 'type': 'string', - 'format': 'uri', - 'nullable': True, - 'example': 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/1.png' - }, - 'example': { - 'back_default': 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/1.png', - 'back_female': None, - 'back_shiny': 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/1.png', - 'back_shiny_female': None, - 'front_default': 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/1.png', - 'front_female': None, - 'front_shiny': 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/shiny/1.png', - 'front_shiny_female': None, - } - }) + @extend_schema_field( + field={ + "type": "object", + "properties": { + "front_default": { + "type": "string", + "format": "uri", + "exmaple": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/1.png", + } + }, + "additionalProperties": { # Stoplight Elements doesn't render this well + "type": "string", + "format": "uri", + "nullable": True, + "example": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/1.png", + }, + "example": { + "back_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/1.png", + "back_female": None, + "back_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/1.png", + "back_shiny_female": None, + "front_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/1.png", + "front_female": None, + "front_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/shiny/1.png", + "front_shiny_female": None, + }, + } + ) def get_pokemon_sprites(self, obj): sprites_object = PokemonSprites.objects.get(pokemon_id=obj) return sprites_object.sprites - @extend_schema_field(field={'type': 'object', - 'required': [ 'latest', 'legacy' ], - 'properties': { - 'latest': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://raw.githubusercontent.com/PokeAPI/cries/main/cries/pokemon/latest/50.ogg' - }, - 'legacy': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://raw.githubusercontent.com/PokeAPI/cries/main/cries/pokemon/legacy/50.ogg' - } - } - }) + @extend_schema_field( + field={ + "type": "object", + "required": ["latest", "legacy"], + "properties": { + "latest": { + "type": "string", + "format": "uri", + "example": "https://raw.githubusercontent.com/PokeAPI/cries/main/cries/pokemon/latest/50.ogg", + }, + "legacy": { + "type": "string", + "format": "uri", + "example": "https://raw.githubusercontent.com/PokeAPI/cries/main/cries/pokemon/legacy/50.ogg", + }, + }, + } + ) def get_pokemon_cries(self, obj): cries_object = PokemonCries.objects.get(pokemon_id=obj) return cries_object.cries @@ -4495,72 +4418,73 @@ def get_pokemon_cries(self, obj): # "url": "https://pokeapi.co/api/v2/version-group/1/" # } # }, - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'move', 'version_group_details' ], - 'properties': { - 'move': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'scratch' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/move/10/' - } - } - }, - 'version_group_details': { - 'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'level_learned_at', 'move_learn_method', 'version_group' ], - 'properties': { - 'level_learned_at': { - 'type': 'number', - 'example': 1 - }, - 'move_learn_method': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'level-up' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/move-learn-method/1/' - } - } - }, - 'version_group': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'red-blue' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/version-group/1/' - } - } - } - } - } - } - } - } - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["move", "version_group_details"], + "properties": { + "move": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "scratch"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/move/10/", + }, + }, + }, + "version_group_details": { + "type": "array", + "items": { + "type": "object", + "required": [ + "level_learned_at", + "move_learn_method", + "version_group", + ], + "properties": { + "level_learned_at": {"type": "number", "example": 1}, + "move_learn_method": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": { + "type": "string", + "example": "level-up", + }, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/move-learn-method/1/", + }, + }, + }, + "version_group": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": { + "type": "string", + "example": "red-blue", + }, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/version-group/1/", + }, + }, + }, + }, + }, + }, + }, + }, + } + ) def get_pokemon_moves(self, obj): version_objects = VersionGroup.objects.all() version_data = VersionGroupSummarySerializer( @@ -4625,54 +4549,48 @@ def get_pokemon_moves(self, obj): # "url": "https://pokeapi.co/api/v2/version/12/" # } # }, - @extend_schema_field(field={'type': 'object', - 'required': [ 'item', 'version_details' ], - 'properties': { - 'item': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'soft-sand' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/item/214/' - } - } - }, - 'version_details': { - 'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'rarity', 'version' ], - 'properties': { - 'rarity': { - 'type': 'number', - 'example': 5 - }, - 'version': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'diamond' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/version/12/' - } - } - } - } - } - }, - } - }) + @extend_schema_field( + field={ + "type": "object", + "required": ["item", "version_details"], + "properties": { + "item": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "soft-sand"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/item/214/", + }, + }, + }, + "version_details": { + "type": "array", + "items": { + "type": "object", + "required": ["rarity", "version"], + "properties": { + "rarity": {"type": "number", "example": 5}, + "version": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "diamond"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/version/12/", + }, + }, + }, + }, + }, + }, + }, + } + ) def get_pokemon_held_items(self, obj): # Get items related to this pokemon and pull out unique Item IDs pokemon_items = PokemonItem.objects.filter(pokemon_id=obj).order_by("item_id") @@ -4714,37 +4632,31 @@ def get_pokemon_held_items(self, obj): # "is_hidden": false, # "slot": 1 # }, - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'ability', 'is_hidden', 'slot' ], - 'properties': { - 'ability': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'sand-veil' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/ability/8/' - } - } - }, - 'is_hidden': { - 'type': 'boolean', - 'example': False - }, - 'slot': { - 'type': 'number', - 'example': 1 - }, - } - } - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["ability", "is_hidden", "slot"], + "properties": { + "ability": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "sand-veil"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/ability/8/", + }, + }, + }, + "is_hidden": {"type": "boolean", "example": False}, + "slot": {"type": "number", "example": 1}, + }, + }, + } + ) def get_pokemon_abilities(self, obj): pokemon_ability_objects = PokemonAbility.objects.filter(pokemon=obj) data = PokemonAbilitySerializer( @@ -4774,61 +4686,55 @@ def get_pokemon_abilities(self, obj): # "url": "https://pokeapi.co/api/v2/generation/6/" # } # } - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'abilities', 'generation' ], - 'properties': { - 'abilities': { - 'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'ability', 'is_hidden', 'slot' ], - 'properties': { - 'ability': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'levitate' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/ability/26/' - } - } - }, - 'is_hidden': { - 'type': 'boolean', - 'example': False - }, - 'slot': { - 'type': 'number', - 'example': 1 - } - } - } - }, - 'generation': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'generation-vi' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/generation/6/' - } - } - }, - } - } - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["abilities", "generation"], + "properties": { + "abilities": { + "type": "array", + "items": { + "type": "object", + "required": ["ability", "is_hidden", "slot"], + "properties": { + "ability": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": { + "type": "string", + "example": "levitate", + }, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/ability/26/", + }, + }, + }, + "is_hidden": {"type": "boolean", "example": False}, + "slot": {"type": "number", "example": 1}, + }, + }, + }, + "generation": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "generation-vi"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/generation/6/", + }, + }, + }, + }, + }, + } + ) def get_past_pokemon_abilities(self, obj): pokemon_past_ability_objects = PokemonAbilityPast.objects.filter(pokemon=obj) pokemon_past_abilities = PokemonAbilityPastSerializer( @@ -4871,33 +4777,30 @@ def get_past_pokemon_abilities(self, obj): # "url": "https://pokeapi.co/api/v2/type/8/" # } # }, - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'slot', 'type' ], - 'properties': { - 'slot': { - 'type': 'number', - 'example': 1 - }, - 'type': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'ghost' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/type/8/' - } - } - } - } - } - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["slot", "type"], + "properties": { + "slot": {"type": "number", "example": 1}, + "type": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "ghost"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/type/8/", + }, + }, + }, + }, + }, + } + ) def get_pokemon_types(self, obj): poke_type_objects = PokemonType.objects.filter(pokemon=obj) poke_types = PokemonTypeSerializer( @@ -4909,74 +4812,68 @@ def get_pokemon_types(self, obj): return poke_types - # "past_types": [ - # { - # "generation": { - # "name": "generation-v", - # "url": "https://pokeapi.co/api/v2/generation/5/" - # }, - # "types": [ - # { - # "slot": 1, - # "type": { - # "name": "normal", - # "url": "https://pokeapi.co/api/v2/type/1/" - # } - # } - # ] - # } - # ], - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'generation', 'types' ], - 'properties':{ - 'generation': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'generation-v' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/generation/5/' - } - } - }, - 'types': { - 'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'slot', 'type' ], - 'properties': { - 'slot': { - 'type': 'number', - 'example': 1 - }, - 'type': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'normal' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/type/1/' - } - } - }, - } - } - }, - } - } - }) + # "past_types": [ + # { + # "generation": { + # "name": "generation-v", + # "url": "https://pokeapi.co/api/v2/generation/5/" + # }, + # "types": [ + # { + # "slot": 1, + # "type": { + # "name": "normal", + # "url": "https://pokeapi.co/api/v2/type/1/" + # } + # } + # ] + # } + # ], + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["generation", "types"], + "properties": { + "generation": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "generation-v"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/generation/5/", + }, + }, + }, + "types": { + "type": "array", + "items": { + "type": "object", + "required": ["slot", "type"], + "properties": { + "slot": {"type": "number", "example": 1}, + "type": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "normal"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/type/1/", + }, + }, + }, + }, + }, + }, + }, + }, + } + ) def get_past_pokemon_types(self, obj): poke_past_type_objects = PokemonTypePast.objects.filter(pokemon=obj) poke_past_types = PokemonTypePastSerializer( @@ -5012,10 +4909,12 @@ def get_past_pokemon_types(self, obj): return final_data - @extend_schema_field(field={ - 'type': 'string', - 'example': 'https://pokeapi.co/api/v2/pokemon/1/encounters' - }) + @extend_schema_field( + field={ + "type": "string", + "example": "https://pokeapi.co/api/v2/pokemon/1/encounters", + } + ) def get_encounters(self, obj): return reverse("pokemon_encounters", kwargs={"pokemon_id": obj.pk}) @@ -5041,24 +4940,23 @@ class Meta: model = EvolutionTrigger fields = ("id", "name", "names", "pokemon_species") - @extend_schema_field(field={ - 'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'ivysaur' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/pokemon-species/2/' - } - } - } - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "ivysaur"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/pokemon-species/2/", + }, + }, + }, + } + ) def get_species(self, obj): evo_objects = PokemonEvolution.objects.filter(evolution_trigger=obj) species_list = [] @@ -5166,33 +5064,30 @@ class Meta: "varieties", ) - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'language', 'name' ], - 'properties': { - 'language': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'en' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/language/9/' - } - } - }, - 'name': { - 'type': 'string', - 'example': 'bulbasaur' - } - } - } - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["language", "name"], + "properties": { + "language": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "en"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/language/9/", + }, + }, + }, + "name": {"type": "string", "example": "bulbasaur"}, + }, + }, + } + ) def get_pokemon_names(self, obj): species_results = PokemonSpeciesName.objects.filter(pokemon_species=obj) species_serializer = PokemonSpeciesNameSerializer( @@ -5213,33 +5108,30 @@ def get_pokemon_names(self, obj): # "url": "https://pokeapi.co/api/v2/language/9/" # } # }, - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'genus', 'language' ], - 'properties': { - 'genus': { - 'type': 'string', - 'example': 'Seed Pokémon' - }, - 'language': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'en' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/language/9/' - } - } - } - } - } - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["genus", "language"], + "properties": { + "genus": {"type": "string", "example": "Seed Pokémon"}, + "language": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "en"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/language/9/", + }, + }, + }, + }, + }, + } + ) def get_pokemon_genera(self, obj): results = PokemonSpeciesName.objects.filter(pokemon_species=obj) serializer = PokemonSpeciesNameSerializer( @@ -5255,23 +5147,23 @@ def get_pokemon_genera(self, obj): return genera - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'monster' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/egg-group/1/' - } - } - } - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "monster"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/egg-group/1/", + }, + }, + }, + } + ) def get_pokemon_egg_groups(self, obj): results = PokemonEggGroup.objects.filter(pokemon_species=obj) data = PokemonEggGroupSerializer(results, many=True, context=self.context).data @@ -5281,33 +5173,30 @@ def get_pokemon_egg_groups(self, obj): return groups - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'is_default', 'pokemon' ], - 'properties': { - 'is_default': { - 'type': 'boolean', - 'example': True - }, - 'pokemon': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'bulbasaur' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/pokemon/1/' - } - } - } - } - } - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["is_default", "pokemon"], + "properties": { + "is_default": {"type": "boolean", "example": True}, + "pokemon": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "bulbasaur"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/pokemon/1/", + }, + }, + }, + }, + }, + } + ) def get_pokemon_varieties(self, obj): results = Pokemon.objects.filter(pokemon_species=obj) summary_data = PokemonSummarySerializer( @@ -5327,37 +5216,31 @@ def get_pokemon_varieties(self, obj): return varieties - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'area', 'base_score', 'rate' ], - 'properties': { - 'area': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'field' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/pal-park-area/2/' - } - } - }, - 'base_score': { - 'type': 'number', - 'example': 50 - }, - 'rate': { - 'type': 'number', - 'example': 30 - } - } - } - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["area", "base_score", "rate"], + "properties": { + "area": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "field"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/pal-park-area/2/", + }, + }, + }, + "base_score": {"type": "number", "example": 50}, + "rate": {"type": "number", "example": 30}, + }, + }, + } + ) def get_encounters(self, obj): pal_park_objects = PalPark.objects.filter(pokemon_species=obj) parks = PalParkSerializer( @@ -5416,228 +5299,205 @@ class Meta: fields = ("id", "baby_trigger_item", "chain") # TODO: Revisit Schema - @extend_schema_field(field={'type': 'object', - 'required': [ - 'evolution_details', - 'evolves_to', - 'is_baby', - 'species' - ], - 'properties': { - 'evolution_details': { - 'type': 'array', - 'items': { - }, - 'example': [] - }, - 'evolves_to': { - 'type': 'array', - 'items': { - 'type': 'object', - 'required': [ - 'evolution_details', - 'evolves_to', - 'is_baby', - 'species' - ], - 'properties': { - 'evolution_details': { - 'type': 'array', - 'items': { - 'type': 'object', - 'required': [ - 'gender', - 'held_item', - 'item', - 'known_move', - 'known_move_type', - 'location', - 'min_affection', - 'min_beauty', - 'min_happiness', - 'min_level', - 'needs_overworld_rain', - 'party_species', - 'party_type', - 'relative_physical_stats', - 'time_of_day', - 'trade_species', - 'trigger', - 'turn_upside_down' - ], - 'properties': { - 'gender': { - 'type': '', - 'nullable': True, - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 1 - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 2 - } - } - }, - 'held_item': { - 'type': 'object', - 'nullable': True, - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 1 - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 2 - } - } - }, - 'item': { - 'type': 'object', - 'nullable': True, - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 1 - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 2 - } - } - }, - 'known_move': { - 'type': '', - 'nullable': True, - }, - 'known_move_type': { - 'type': '', - 'nullable': True, - }, - 'location': { - 'type': 'object', - 'nullable': True, - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - }, - 'url': { - 'type': 'string', - 'format': 'uri', - } - } - }, - 'min_affection': { - 'type': 'number', - 'nullable': True - }, - 'min_beauty': { - 'type': 'number', - 'nullable': True - }, - 'min_happiness': { - 'type': 'number', - 'nullable': True - }, - 'min_level': { - 'type': 'number', - 'nullable': True - }, - 'needs_overworld_rain': { - 'type': 'boolean', - 'nullable': True - }, - 'party_species': { - 'type': 'string', - 'nullable': True - }, - 'party_type': { - 'type': 'string', - 'nullable': True - }, - 'relative_physical_stats': { - 'type': 'string', - 'nullable': True - }, - 'time_of_day': { - 'type': 'string' - }, - 'trade_species': { - 'type': 'string', - 'nullable': True - }, - 'trigger': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - }, - 'url': { - 'type': 'string', - 'format': 'uri' - } - } - }, - 'turn_upside_down': { - 'type': 'boolean' - } - } - } - }, - 'is_baby': { - 'type': 'boolean', - 'example': True - }, - 'species': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'happiny' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/pokemon-species/440/' - } - } - } - } - } - }, - 'is_baby': { - 'type': 'boolean', - 'example': True - }, - 'species': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'happiny' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/pokemon-species/440/' - } - } - } - } - }) + @extend_schema_field( + field={ + "type": "object", + "required": ["evolution_details", "evolves_to", "is_baby", "species"], + "properties": { + "evolution_details": {"type": "array", "items": {}, "example": []}, + "evolves_to": { + "type": "array", + "items": { + "type": "object", + "required": [ + "evolution_details", + "evolves_to", + "is_baby", + "species", + ], + "properties": { + "evolution_details": { + "type": "array", + "items": { + "type": "object", + "required": [ + "gender", + "held_item", + "item", + "known_move", + "known_move_type", + "location", + "min_affection", + "min_beauty", + "min_happiness", + "min_level", + "needs_overworld_rain", + "party_species", + "party_type", + "relative_physical_stats", + "time_of_day", + "trade_species", + "trigger", + "turn_upside_down", + ], + "properties": { + "gender": { + "type": "", + "nullable": True, + "type": "object", + "required": ["name", "url"], + "properties": { + "name": { + "type": "string", + "example": 1, + }, + "url": { + "type": "string", + "format": "uri", + "example": 2, + }, + }, + }, + "held_item": { + "type": "object", + "nullable": True, + "required": ["name", "url"], + "properties": { + "name": { + "type": "string", + "example": 1, + }, + "url": { + "type": "string", + "format": "uri", + "example": 2, + }, + }, + }, + "item": { + "type": "object", + "nullable": True, + "required": ["name", "url"], + "properties": { + "name": { + "type": "string", + "example": 1, + }, + "url": { + "type": "string", + "format": "uri", + "example": 2, + }, + }, + }, + "known_move": { + "type": "", + "nullable": True, + }, + "known_move_type": { + "type": "", + "nullable": True, + }, + "location": { + "type": "object", + "nullable": True, + "required": ["name", "url"], + "properties": { + "name": { + "type": "string", + }, + "url": { + "type": "string", + "format": "uri", + }, + }, + }, + "min_affection": { + "type": "number", + "nullable": True, + }, + "min_beauty": { + "type": "number", + "nullable": True, + }, + "min_happiness": { + "type": "number", + "nullable": True, + }, + "min_level": { + "type": "number", + "nullable": True, + }, + "needs_overworld_rain": { + "type": "boolean", + "nullable": True, + }, + "party_species": { + "type": "string", + "nullable": True, + }, + "party_type": { + "type": "string", + "nullable": True, + }, + "relative_physical_stats": { + "type": "string", + "nullable": True, + }, + "time_of_day": {"type": "string"}, + "trade_species": { + "type": "string", + "nullable": True, + }, + "trigger": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": { + "type": "string", + }, + "url": { + "type": "string", + "format": "uri", + }, + }, + }, + "turn_upside_down": {"type": "boolean"}, + }, + }, + }, + "is_baby": {"type": "boolean", "example": True}, + "species": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "happiny"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/pokemon-species/440/", + }, + }, + }, + }, + }, + }, + "is_baby": {"type": "boolean", "example": True}, + "species": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "happiny"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/pokemon-species/440/", + }, + }, + }, + }, + } + ) def build_chain(self, obj): chain_id = obj.id @@ -5750,69 +5610,66 @@ class Meta: model = PokeathlonStat fields = ("id", "name", "affecting_natures", "names") - @extend_schema_field(field={'type': 'object', - 'required': [ 'decrease', 'increase' ], - 'properties': { - 'decrease': { - 'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'max_change', 'nature' ], - 'properties': { - 'max_change': { - 'type': 'number', - 'maximum': -1, - 'example': -1 - }, - 'nature': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'hardy' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/nature/1/' - } - } - } - } - } - }, - 'increase': { - 'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'max_change', 'nature' ], - 'properties': { - 'max_change': { - 'type': 'number', - 'minimum': 1, - 'example': 2 - }, - 'nature': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'hardy' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/nature/1/' - } - } - } - } - } - } - } - }) + @extend_schema_field( + field={ + "type": "object", + "required": ["decrease", "increase"], + "properties": { + "decrease": { + "type": "array", + "items": { + "type": "object", + "required": ["max_change", "nature"], + "properties": { + "max_change": { + "type": "number", + "maximum": -1, + "example": -1, + }, + "nature": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "hardy"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/nature/1/", + }, + }, + }, + }, + }, + }, + "increase": { + "type": "array", + "items": { + "type": "object", + "required": ["max_change", "nature"], + "properties": { + "max_change": { + "type": "number", + "minimum": 1, + "example": 2, + }, + "nature": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "hardy"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/nature/1/", + }, + }, + }, + }, + }, + }, + }, + } + ) def get_natures_that_affect(self, obj): stat_change_objects = NaturePokeathlonStat.objects.filter(pokeathlon_stat=obj) stat_changes = NaturePokeathlonStatSerializer( @@ -5871,33 +5728,30 @@ class Meta: "version_groups", ) - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'entry_number', 'pokemon_species' ], - 'properties': { - 'entry_number': { - 'type': 'number', - 'example': 1 - }, - 'pokemon_species': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'bulbasaur' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/pokemon-species/1/' - } - } - } - } - } - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["entry_number", "pokemon_species"], + "properties": { + "entry_number": {"type": "number", "example": 1}, + "pokemon_species": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "bulbasaur"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/pokemon-species/1/", + }, + }, + }, + }, + }, + } + ) def get_pokedex_entries(self, obj): results = PokemonDexNumber.objects.filter(pokedex=obj).order_by( "pokedex_number" @@ -5912,23 +5766,23 @@ def get_pokedex_entries(self, obj): return data - @extend_schema_field(field={'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'the-teal-mask' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/version-group/26/' - } - } - } - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "the-teal-mask"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/version-group/26/", + }, + }, + }, + } + ) def get_pokedex_version_groups(self, obj): dex_group_objects = PokedexVersionGroup.objects.filter(pokedex=obj) dex_groups = PokedexVersionGroupSerializer( @@ -5988,24 +5842,23 @@ class Meta: "versions", ) - @extend_schema_field(field={ - 'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'kanto' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/region/1/' - } - } - } - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "kanto"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/region/1/", + }, + }, + }, + } + ) def get_version_group_regions(self, obj): vg_regions = VersionGroupRegion.objects.filter(version_group=obj) data = VersionGroupRegionSerializer( @@ -6018,26 +5871,25 @@ def get_version_group_regions(self, obj): return regions - # "name": "level-up", - # "url": "https://pokeapi.co/api/v2/move-learn-method/1/" - @extend_schema_field(field={ - 'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'level-up' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/move-learn-method/1/' - } - } - } - }) + # "name": "level-up", + # "url": "https://pokeapi.co/api/v2/move-learn-method/1/" + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "level-up"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/move-learn-method/1/", + }, + }, + }, + } + ) def get_learn_methods(self, obj): learn_method_objects = VersionGroupMoveLearnMethod.objects.filter( version_group=obj @@ -6052,24 +5904,23 @@ def get_learn_methods(self, obj): return methods - @extend_schema_field(field={ - 'type': 'array', - 'items': { - 'type': 'object', - 'required': [ 'name', 'url' ], - 'properties': { - 'name': { - 'type': 'string', - 'example': 'kanto' - }, - 'url': { - 'type': 'string', - 'format': 'uri', - 'example': 'https://pokeapi.co/api/v2/pokedex/2/' - } - } - } - }) + @extend_schema_field( + field={ + "type": "array", + "items": { + "type": "object", + "required": ["name", "url"], + "properties": { + "name": {"type": "string", "example": "kanto"}, + "url": { + "type": "string", + "format": "uri", + "example": "https://pokeapi.co/api/v2/pokedex/2/", + }, + }, + }, + } + ) def get_version_groups_pokedexes(self, obj): dex_group_objects = PokedexVersionGroup.objects.filter(version_group=obj) dex_groups = PokedexVersionGroupSerializer( From 77a4570b1586017cd11b1278e842f6e9e877fdf1 Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Wed, 6 Mar 2024 22:27:43 -0600 Subject: [PATCH 42/49] fix: misplace `required` (PR review) --- pokemon_v2/serializers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pokemon_v2/serializers.py b/pokemon_v2/serializers.py index 463b60f41..6ac8754cc 100644 --- a/pokemon_v2/serializers.py +++ b/pokemon_v2/serializers.py @@ -3228,8 +3228,8 @@ def get_move_machines(self, obj): @extend_schema_field( field={ "type": "object", + "required": ["normal", "super"], "properties": { - "required": ["normal", "super"], "normal": { "type": "object", "required": ["use_before", "use_after"], From 89e55332c94c7705e0b16daeba03e29d38a473b1 Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Wed, 6 Mar 2024 23:17:01 -0600 Subject: [PATCH 43/49] feat: id parameter (not working) --- openapi.yml | 6 +++--- pokemon_v2/api.py | 13 ++++++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/openapi.yml b/openapi.yml index 195508277..51fb83e66 100644 --- a/openapi.yml +++ b/openapi.yml @@ -5164,10 +5164,10 @@ components: minimum: -2147483648 contest_combos: type: object + required: + - normal + - super properties: - required: - - normal - - super normal: type: object required: diff --git a/pokemon_v2/api.py b/pokemon_v2/api.py index 77512e0e1..ba2a0ef52 100644 --- a/pokemon_v2/api.py +++ b/pokemon_v2/api.py @@ -4,7 +4,8 @@ from rest_framework.views import APIView from django.shortcuts import get_object_or_404 from django.http import Http404 -from drf_spectacular.utils import extend_schema, extend_schema_view +from drf_spectacular.utils import extend_schema, extend_schema_view, OpenApiParameter +from drf_spectacular.types import OpenApiTypes from .models import * from .serializers import * @@ -39,6 +40,16 @@ class NameOrIdRetrieval: idPattern = re.compile(r"^-?[0-9]+$") namePattern = re.compile(r"^[0-9A-Za-z\-\+]+$") + @extend_schema( + parameters=[ + OpenApiParameter( + name="id", + description="This parameter can be a string or an integer.", + location=OpenApiParameter.PATH, + type=OpenApiTypes.STR, + ), + ] + ) def get_object(self): queryset = self.get_queryset() queryset = self.filter_queryset(queryset) From a5aff843c9cad97620062122d1f673357a00c919 Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Thu, 7 Mar 2024 01:27:05 -0600 Subject: [PATCH 44/49] docs: overview --- config/settings.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/config/settings.py b/config/settings.py index 98d3bbdf0..5459cc7db 100755 --- a/config/settings.py +++ b/config/settings.py @@ -140,8 +140,23 @@ DEFAULT_AUTO_FIELD = "django.db.models.AutoField" SPECTACULAR_SETTINGS = { - "TITLE": "pokeapi", - "DESCRIPTION": "A RESTful API for Pokémon.", + "TITLE": "PokéAPI", + "DESCRIPTION": """All the Pokémon data you'll ever need in one place, easily accessible through a modern free open-source RESTful API. + +## What is this? + +This is a full RESTful API linked to an extensive database detailing everything about the Pokémon main game series. + +We've covered everything from Pokémon to Berry Flavors. + +## Where do I start? + +We have awesome [documentation](https://pokeapi.co/docs/v2) on how to use this API. It takes minutes to get started. + +This API will always be publicly available and will never require any extensive setup process to consume. + +Created by [**Paul Hallett**(]https://github.com/phalt) and other [**PokéAPI contributors***](https://github.com/PokeAPI/pokeapi#contributing) around the world. Pokémon and Pokémon character names are trademarks of Nintendo. + """, "SERVERS": [{"url": "https://pokeapi.co"}], "EXTERNAL_DOCS": {"url": "https://pokeapi.co/docs/v2"}, "VERSION": "2.7.0", From 777abcc6560f94085cdb587e2f01eaf500157f41 Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Thu, 7 Mar 2024 01:28:42 -0600 Subject: [PATCH 45/49] docs: overview --- openapi.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/openapi.yml b/openapi.yml index 51fb83e66..a0fef9260 100644 --- a/openapi.yml +++ b/openapi.yml @@ -1,8 +1,18 @@ openapi: 3.1.0 info: - title: pokeapi + title: PokéAPI version: 2.7.0 - description: A RESTful API for Pokémon. + description: "All the Pokémon data you'll ever need in one place, easily accessible\ + \ through a modern free open-source RESTful API.\n\n## What is this?\n\nThis is\ + \ a full RESTful API linked to an extensive database detailing everything about\ + \ the Pokémon main game series.\n\nWe've covered everything from Pokémon to Berry\ + \ Flavors.\n\n## Where do I start?\n\nWe have awesome [documentation](https://pokeapi.co/docs/v2)\ + \ on how to use this API. It takes minutes to get started.\n\nThis API will always\ + \ be publicly available and will never require any extensive setup process to\ + \ consume.\n\nCreated by [**Paul Hallett**(]https://github.com/phalt) and other\ + \ [**PokéAPI contributors***](https://github.com/PokeAPI/pokeapi#contributing)\ + \ around the world. Pokémon and Pokémon character names are trademarks of Nintendo.\n\ + \ " paths: /api/v2/ability/: get: From 5e02a377cddc1539d50e43ed1427b00b7ac3e889 Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Tue, 26 Mar 2024 23:59:57 -0500 Subject: [PATCH 46/49] fix: use correct type, add format --- openapi.yml | 93 ++++++++++++++++++++++++++------------- pokemon_v2/serializers.py | 62 +++++++++++++------------- 2 files changed, 93 insertions(+), 62 deletions(-) diff --git a/openapi.yml b/openapi.yml index a0fef9260..516011921 100644 --- a/openapi.yml +++ b/openapi.yml @@ -3049,7 +3049,8 @@ components: type: boolean example: true slot: - type: number + type: integer + format: int32 example: 3 pokemon: type: object @@ -3360,7 +3361,8 @@ components: possible_values: type: array items: - type: number + type: integer + format: int32 example: - 0 - 5 @@ -3821,16 +3823,20 @@ components: type: string format: uri min_affection: - type: number + type: integer + format: int32 nullable: true min_beauty: - type: number + type: integer + format: int32 nullable: true min_happiness: - type: number + type: integer + format: int32 nullable: true min_level: - type: number + type: integer + format: int32 nullable: true needs_overworld_rain: type: boolean @@ -3999,7 +4005,8 @@ components: - pokemon_species properties: rate: - type: number + type: integer + format: int32 example: 1 pokemon_species: type: object @@ -4398,7 +4405,8 @@ components: - version properties: rarity: - type: number + type: integer + format: int32 example: 5 version: type: object @@ -4729,7 +4737,8 @@ components: - version properties: rate: - type: number + type: integer + format: int32 example: 5 version: type: object @@ -4796,7 +4805,8 @@ components: format: uri example: https://pokeapi.co/api/v2/version/12/ max_chance: - type: number + type: integer + format: int32 example: 60 encounter_details: type: object @@ -4808,10 +4818,12 @@ components: - method properties: min_level: - type: number + type: integer + format: int32 example: 20 max_level: - type: number + type: integer + format: int32 example: 30 condition_values: type: object @@ -4827,7 +4839,8 @@ components: format: uri example: https://pokeapi.co/api/v2/encounter-condition-value/10/ chance: - type: number + type: integer + format: int32 example: 60 method: type: object @@ -5361,7 +5374,8 @@ components: - stat properties: change: - type: number + type: integer + format: int32 example: 2 stat: type: object @@ -5867,7 +5881,8 @@ components: - pokeathlon_stat properties: max_change: - type: number + type: integer + format: int32 example: 1 pokeathlon_stat: type: object @@ -6912,7 +6927,8 @@ components: - rate properties: base_score: - type: number + type: integer + format: int32 example: 50 pokemon-species: type: object @@ -6928,7 +6944,8 @@ components: format: uri example: https://pokeapi.co/api/v2/pokemon-species/1/ rate: - type: number + type: integer + format: int32 example: 30 readOnly: true required: @@ -6984,7 +7001,8 @@ components: - nature properties: max_change: - type: number + type: integer + format: int32 maximum: -1 example: -1 nature: @@ -7009,7 +7027,8 @@ components: - nature properties: max_change: - type: number + type: integer + format: int32 minimum: 1 example: 2 nature: @@ -7100,7 +7119,8 @@ components: - pokemon_species properties: entry_number: - type: number + type: integer + format: int32 example: 1 pokemon_species: type: object @@ -7275,7 +7295,8 @@ components: type: boolean example: false slot: - type: number + type: integer + format: int32 example: 1 readOnly: true past_abilities: @@ -7312,7 +7333,8 @@ components: type: boolean example: false slot: - type: number + type: integer + format: int32 example: 1 generation: type: object @@ -7366,7 +7388,8 @@ components: - version properties: rarity: - type: number + type: integer + format: int32 example: 5 version: type: object @@ -7417,7 +7440,8 @@ components: - version_group properties: level_learned_at: - type: number + type: integer + format: int32 example: 1 move_learn_method: type: object @@ -7499,7 +7523,8 @@ components: - type properties: slot: - type: number + type: integer + format: int32 example: 1 type: type: object @@ -7545,7 +7570,8 @@ components: - type properties: slot: - type: number + type: integer + format: int32 example: 1 type: type: object @@ -7702,7 +7728,8 @@ components: - type properties: slot: - type: number + type: integer + format: int32 example: 1 type: type: object @@ -8017,10 +8044,12 @@ components: format: uri example: https://pokeapi.co/api/v2/pal-park-area/2/ base_score: - type: number + type: integer + format: int32 example: 50 rate: - type: number + type: integer + format: int32 example: 30 readOnly: true form_descriptions: @@ -8263,7 +8292,8 @@ components: - move properties: change: - type: number + type: integer + format: int32 example: -1 move: type: object @@ -8287,7 +8317,8 @@ components: - move properties: change: - type: number + type: integer + format: int32 example: 5 move: type: object diff --git a/pokemon_v2/serializers.py b/pokemon_v2/serializers.py index 6ac8754cc..47e195090 100644 --- a/pokemon_v2/serializers.py +++ b/pokemon_v2/serializers.py @@ -482,7 +482,7 @@ class Meta: field={ "type": "array", "items": { - "type": "number", + "type": "integer", "format": "int32", }, "example": [0, 5, 10, 15, 20, 25, 30], } @@ -710,7 +710,7 @@ class Meta: "type": "object", "required": ["rate", "pokemon_species"], "properties": { - "rate": {"type": "number", "example": 1}, + "rate": {"type": "integer", "format": "int32", "example": 1}, "pokemon_species": { "type": "object", "required": ["name", "url"], @@ -1000,7 +1000,7 @@ class Meta: "type": "object", "required": ["rate", "version"], "properties": { - "rate": {"type": "number", "example": 5}, + "rate": {"type": "integer", "format": "int32", "example": 5}, "version": { "type": "object", "required": ["name", "url"], @@ -1104,7 +1104,7 @@ def get_method_rates(self, obj): }, }, }, - "max_chance": {"type": "number", "example": 60}, + "max_chance": {"type": "integer", "format": "int32", "example": 60}, "encounter_details": { "type": "object", "required": [ @@ -1115,8 +1115,8 @@ def get_method_rates(self, obj): "method", ], "properties": { - "min_level": {"type": "number", "example": 20}, - "max_level": {"type": "number", "example": 30}, + "min_level": {"type": "integer", "format": "int32", "example": 20}, + "max_level": {"type": "integer", "format": "int32", "example": 30}, "condition_values": { "type": "object", "required": ["name", "url"], @@ -1132,7 +1132,7 @@ def get_method_rates(self, obj): }, }, }, - "chance": {"type": "number", "example": 60}, + "chance": {"type": "integer", "format": "int32", "example": 60}, "method": { "type": "object", "required": ["name", "url"], @@ -1336,7 +1336,7 @@ class Meta: "required": ["is_hidden", "slot", "pokemon"], "properties": { "is_hidden": {"type": "boolean", "example": True}, - "slot": {"type": "number", "example": 3}, + "slot": {"type": "integer", "format": "int32", "example": 3}, "pokemon": { "type": "object", "required": ["name", "url"], @@ -1414,7 +1414,7 @@ class Meta: "type": "object", "required": ["change", "move"], "properties": { - "change": {"type": "number", "example": -1}, + "change": {"type": "integer", "format": "int32", "example": -1}, "move": { "type": "object", "required": ["name", "url"], @@ -1439,7 +1439,7 @@ class Meta: "type": "object", "required": ["change", "move"], "properties": { - "change": {"type": "number", "example": 5}, + "change": {"type": "integer", "format": "int32", "example": 5}, "move": { "type": "object", "required": ["name", "url"], @@ -1863,7 +1863,7 @@ def get_item_attributes(self, obj): "type": "object", "required": ["rarity", "version"], "properties": { - "rarity": {"type": "number", "example": 5}, + "rarity": {"type": "integer", "format": "int32", "example": 5}, "version": { "type": "object", "required": ["name", "url"], @@ -1999,7 +1999,7 @@ class Meta: "type": "object", "required": ["max_change", "pokeathlon_stat"], "properties": { - "max_change": {"type": "number", "example": 1}, + "max_change": {"type": "integer", "format": "int32", "example": 1}, "pokeathlon_stat": { "type": "object", "required": ["name", "url"], @@ -3480,7 +3480,7 @@ def get_effect_change_text(self, obj): "type": "object", "required": ["change", "stat"], "properties": { - "change": {"type": "number", "example": 2}, + "change": {"type": "integer", "format": "int32", "example": 2}, "stat": { "type": "object", "required": ["name", "url"], @@ -3548,7 +3548,7 @@ class Meta: "type": "object", "required": ["base_score", "pokemon-species", "rate"], "properties": { - "base_score": {"type": "number", "example": 50}, + "base_score": {"type": "integer", "format": "int32", "example": 50}, "pokemon-species": { "type": "object", "required": ["name", "url"], @@ -3561,7 +3561,7 @@ class Meta: }, }, }, - "rate": {"type": "number", "example": 30}, + "rate": {"type": "integer", "format": "int32", "example": 30}, }, }, } @@ -3768,7 +3768,7 @@ def get_pokemon_form_sprites(self, obj): "type": "object", "required": ["slot", "type"], "properties": { - "slot": {"type": "number", "example": 1}, + "slot": {"type": "integer", "format": "int32", "example": 1}, "type": { "type": "object", "required": ["name", "url"], @@ -4447,7 +4447,7 @@ def get_pokemon_cries(self, obj): "version_group", ], "properties": { - "level_learned_at": {"type": "number", "example": 1}, + "level_learned_at": {"type": "integer", "format": "int32", "example": 1}, "move_learn_method": { "type": "object", "required": ["name", "url"], @@ -4572,7 +4572,7 @@ def get_pokemon_moves(self, obj): "type": "object", "required": ["rarity", "version"], "properties": { - "rarity": {"type": "number", "example": 5}, + "rarity": {"type": "integer", "format": "int32", "example": 5}, "version": { "type": "object", "required": ["name", "url"], @@ -4652,7 +4652,7 @@ def get_pokemon_held_items(self, obj): }, }, "is_hidden": {"type": "boolean", "example": False}, - "slot": {"type": "number", "example": 1}, + "slot": {"type": "integer", "format": "int32", "example": 1}, }, }, } @@ -4715,7 +4715,7 @@ def get_pokemon_abilities(self, obj): }, }, "is_hidden": {"type": "boolean", "example": False}, - "slot": {"type": "number", "example": 1}, + "slot": {"type": "integer", "format": "int32", "example": 1}, }, }, }, @@ -4784,7 +4784,7 @@ def get_past_pokemon_abilities(self, obj): "type": "object", "required": ["slot", "type"], "properties": { - "slot": {"type": "number", "example": 1}, + "slot": {"type": "integer", "format": "int32", "example": 1}, "type": { "type": "object", "required": ["name", "url"], @@ -4854,7 +4854,7 @@ def get_pokemon_types(self, obj): "type": "object", "required": ["slot", "type"], "properties": { - "slot": {"type": "number", "example": 1}, + "slot": {"type": "integer", "format": "int32", "example": 1}, "type": { "type": "object", "required": ["name", "url"], @@ -5235,8 +5235,8 @@ def get_pokemon_varieties(self, obj): }, }, }, - "base_score": {"type": "number", "example": 50}, - "rate": {"type": "number", "example": 30}, + "base_score": {"type": "integer", "format": "int32", "example": 50}, + "rate": {"type": "integer", "format": "int32", "example": 30}, }, }, } @@ -5413,19 +5413,19 @@ class Meta: }, }, "min_affection": { - "type": "number", + "type": "integer", "format": "int32", "nullable": True, }, "min_beauty": { - "type": "number", + "type": "integer", "format": "int32", "nullable": True, }, "min_happiness": { - "type": "number", + "type": "integer", "format": "int32", "nullable": True, }, "min_level": { - "type": "number", + "type": "integer", "format": "int32", "nullable": True, }, "needs_overworld_rain": { @@ -5622,7 +5622,7 @@ class Meta: "required": ["max_change", "nature"], "properties": { "max_change": { - "type": "number", + "type": "integer", "format": "int32", "maximum": -1, "example": -1, }, @@ -5648,7 +5648,7 @@ class Meta: "required": ["max_change", "nature"], "properties": { "max_change": { - "type": "number", + "type": "integer", "format": "int32", "minimum": 1, "example": 2, }, @@ -5735,7 +5735,7 @@ class Meta: "type": "object", "required": ["entry_number", "pokemon_species"], "properties": { - "entry_number": {"type": "number", "example": 1}, + "entry_number": {"type": "integer", "format": "int32", "example": 1}, "pokemon_species": { "type": "object", "required": ["name", "url"], From a5158e216440258485a88d3cd83e49d30c28f9c3 Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Wed, 27 Mar 2024 23:12:13 -0500 Subject: [PATCH 47/49] fix: use `examples` property (`example` is deprecated), fix typo --- openapi.yml | 697 +++++++++++++++++++++++++------------- pokemon_v2/api.py | 2 +- pokemon_v2/serializers.py | 468 ++++++++++++------------- 3 files changed, 692 insertions(+), 475 deletions(-) diff --git a/openapi.yml b/openapi.yml index 516011921..f262ee3bd 100644 --- a/openapi.yml +++ b/openapi.yml @@ -295,7 +295,7 @@ paths: IV. A Pokémon's Characteristic is determined by the remainder of its highest IV divided by 5 (gene_modulo). Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Characteristic) for greater detail. - summary: Get charecterictic + summary: Get characteristic parameters: - in: path name: id @@ -3047,11 +3047,11 @@ components: properties: is_hidden: type: boolean - example: true slot: type: integer format: int32 - example: 3 + examples: + - 3 pokemon: type: object required: @@ -3060,11 +3060,13 @@ components: properties: name: type: string - example: gloom + examples: + - gloom url: type: string format: uri - example: https://pokeapi.co/api/v2/pokemon/44/ + examples: + - https://pokeapi.co/api/v2/pokemon/44/ readOnly: true required: - effect_changes @@ -3172,7 +3174,8 @@ components: properties: potency: type: integer - example: 10 + examples: + - 10 flavor: type: object require: @@ -3182,12 +3185,14 @@ components: name: type: string description: The name of the flavor - example: spicy + examples: + - spicy url: type: string format: uri description: The URL to get more information about the flavor - example: https://pokeapi.co/api/v2/berry-flavor/1/ + examples: + - https://pokeapi.co/api/v2/berry-flavor/1/ readOnly: true item: $ref: '#/components/schemas/ItemSummary' @@ -3273,7 +3278,8 @@ components: properties: potency: type: integer - example: 10 + examples: + - 10 berry: type: object require: @@ -3283,12 +3289,14 @@ components: name: type: string description: The name of the berry - example: rowap + examples: + - rowap url: type: string format: uri description: The URL to get more information about the berry - example: https://pokeapi.co/api/v2/berry/64/ + examples: + - https://pokeapi.co/api/v2/berry/64/ readOnly: true contest_type: $ref: '#/components/schemas/ContestTypeSummary' @@ -3363,14 +3371,14 @@ components: items: type: integer format: int32 - example: - - 0 - - 5 - - 10 - - 15 - - 20 - - 25 - - 30 + examples: + - - 0 + - 5 + - 10 + - 15 + - 20 + - 25 + - 30 readOnly: true highest_stat: $ref: '#/components/schemas/StatSummary' @@ -3531,12 +3539,14 @@ components: name: type: string description: Pokemon species name. - example: bulbasaur + examples: + - bulbasaur url: type: string format: uri description: The URL to get more information about the species - example: https://pokeapi.co/api/v2/pokemon-species/1/ + examples: + - https://pokeapi.co/api/v2/pokemon-species/1/ readOnly: true required: - id @@ -3727,7 +3737,7 @@ components: evolution_details: type: array items: {} - example: [] + examples: [] evolves_to: type: array items: @@ -3771,11 +3781,13 @@ components: properties: name: type: string - example: 1 + examples: + - 1 url: type: string format: uri - example: 2 + examples: + - 2 held_item: type: object nullable: true @@ -3785,11 +3797,13 @@ components: properties: name: type: string - example: 1 + examples: + - 1 url: type: string format: uri - example: 2 + examples: + - 2 item: type: object nullable: true @@ -3799,11 +3813,13 @@ components: properties: name: type: string - example: 1 + examples: + - 1 url: type: string format: uri - example: 2 + examples: + - 2 known_move: type: '' nullable: true @@ -3870,7 +3886,6 @@ components: type: boolean is_baby: type: boolean - example: true species: type: object required: @@ -3879,14 +3894,15 @@ components: properties: name: type: string - example: happiny + examples: + - happiny url: type: string format: uri - example: https://pokeapi.co/api/v2/pokemon-species/440/ + examples: + - https://pokeapi.co/api/v2/pokemon-species/440/ is_baby: type: boolean - example: true species: type: object required: @@ -3895,11 +3911,13 @@ components: properties: name: type: string - example: happiny + examples: + - happiny url: type: string format: uri - example: https://pokeapi.co/api/v2/pokemon-species/440/ + examples: + - https://pokeapi.co/api/v2/pokemon-species/440/ readOnly: true required: - baby_trigger_item @@ -3938,11 +3956,13 @@ components: properties: name: type: string - example: ivysaur + examples: + - ivysaur url: type: string format: uri - example: https://pokeapi.co/api/v2/pokemon-species/2/ + examples: + - https://pokeapi.co/api/v2/pokemon-species/2/ readOnly: true required: - id @@ -4007,7 +4027,8 @@ components: rate: type: integer format: int32 - example: 1 + examples: + - 1 pokemon_species: type: object required: @@ -4016,11 +4037,13 @@ components: properties: name: type: string - example: bulbasaur + examples: + - bulbasaur url: type: string format: uri - example: https://pokeapi.co/api/v2/pokemon-species/1/ + examples: + - https://pokeapi.co/api/v2/pokemon-species/1/ readOnly: true required_for_evolution: type: array @@ -4032,11 +4055,13 @@ components: properties: name: type: string - example: wormadam + examples: + - wormadam url: type: string format: uri - example: https://pokeapi.co/api/v2/pokemon-species/413/ + examples: + - https://pokeapi.co/api/v2/pokemon-species/413/ readOnly: true required: - id @@ -4222,11 +4247,13 @@ components: properties: name: type: string - example: master-ball + examples: + - master-ball url: type: string format: uri - example: https://pokeapi.co/api/v2/item/1/ + examples: + - https://pokeapi.co/api/v2/item/1/ readOnly: true names: type: array @@ -4347,11 +4374,13 @@ components: properties: name: type: string - example: countable + examples: + - countable url: type: string format: uri - example: https://pokeapi.co/api/v2/item-attribute/1/ + examples: + - https://pokeapi.co/api/v2/item-attribute/1/ readOnly: true category: $ref: '#/components/schemas/ItemCategorySummary' @@ -4391,11 +4420,13 @@ components: properties: name: type: string - example: farfetchd + examples: + - farfetchd url: type: string format: uri - example: https://pokeapi.co/api/v2/pokemon/83/ + examples: + - https://pokeapi.co/api/v2/pokemon/83/ version-details: type: array items: @@ -4407,7 +4438,8 @@ components: rarity: type: integer format: int32 - example: 5 + examples: + - 5 version: type: object required: @@ -4416,11 +4448,13 @@ components: properties: name: type: string - example: ruby + examples: + - ruby url: type: string format: uri - example: https://pokeapi.co/api/v2/version/7/ + examples: + - https://pokeapi.co/api/v2/version/7/ readOnly: true sprites: type: object @@ -4430,7 +4464,8 @@ components: default: type: string format: uri - example: https://pokeapi.co/media/sprites/items/master-ball.png + examples: + - https://pokeapi.co/media/sprites/items/master-ball.png readOnly: true baby_trigger_for: type: object @@ -4440,7 +4475,8 @@ components: url: type: string format: uri - example: '"https://pokeapi.co/api/v2/evolution-chain/51/' + examples: + - https://pokeapi.co/api/v2/evolution-chain/51/ readOnly: true machines: type: array @@ -4453,7 +4489,8 @@ components: machine: type: string format: uri - example: https://pokeapi.co/api/v2/machine/1/ + examples: + - https://pokeapi.co/api/v2/machine/1/ version_group: type: object required: @@ -4462,11 +4499,13 @@ components: properties: name: type: string - example: sword-shield + examples: + - sword-shield url: type: string format: uri - example: https://pokeapi.co/api/v2/version-group/20/ + examples: + - https://pokeapi.co/api/v2/version-group/20/ readOnly: true required: - attributes @@ -4723,11 +4762,13 @@ components: properties: name: type: string - example: old-rod + examples: + - old-rod url: type: string format: uri - example: https://pokeapi.co/api/v2/encounter-method/2/ + examples: + - https://pokeapi.co/api/v2/encounter-method/2/ version_details: type: array items: @@ -4739,7 +4780,8 @@ components: rate: type: integer format: int32 - example: 5 + examples: + - 5 version: type: object required: @@ -4748,11 +4790,13 @@ components: properties: name: type: string - example: platinum + examples: + - platinum url: type: string format: uri - example: https://pokeapi.co/api/v2/version/14/ + examples: + - https://pokeapi.co/api/v2/version/14/ readOnly: true location: $ref: '#/components/schemas/LocationSummary' @@ -4777,11 +4821,13 @@ components: properties: name: type: string - example: tentacool + examples: + - tentacool url: type: string format: uri - example: ttps://pokeapi.co/api/v2/pokemon/72/ + examples: + - https://pokeapi.co/api/v2/pokemon/72/ version_details: type: array items: @@ -4799,15 +4845,18 @@ components: properties: name: type: string - example: diamond + examples: + - diamond url: type: string format: uri - example: https://pokeapi.co/api/v2/version/12/ + examples: + - https://pokeapi.co/api/v2/version/12/ max_chance: type: integer format: int32 - example: 60 + examples: + - 60 encounter_details: type: object required: @@ -4820,11 +4869,13 @@ components: min_level: type: integer format: int32 - example: 20 + examples: + - 20 max_level: type: integer format: int32 - example: 30 + examples: + - 30 condition_values: type: object required: @@ -4833,15 +4884,18 @@ components: properties: name: type: string - example: slot2-sapphire + examples: + - slot2-sapphire url: type: string format: uri - example: https://pokeapi.co/api/v2/encounter-condition-value/10/ + examples: + - https://pokeapi.co/api/v2/encounter-condition-value/10/ chance: type: integer format: int32 - example: 60 + examples: + - 60 method: type: object required: @@ -4850,11 +4904,13 @@ components: properties: name: type: string - example: surf + examples: + - surf url: type: string format: uri - example: https://pokeapi.co/api/v2/encounter-method/5/ + examples: + - https://pokeapi.co/api/v2/encounter-method/5/ readOnly: true required: - encounter_method_rates @@ -5059,10 +5115,12 @@ components: properties: effect: type: string - example: Inflicts [regular damage]{mechanic:regular-damage}. + examples: + - Inflicts [regular damage]{mechanic:regular-damage}. short_effect: type: string - example: Inflicts regular damage with no additional effect. + examples: + - Inflicts regular damage with no additional effect. language: type: object required: @@ -5071,11 +5129,13 @@ components: properties: name: type: string - example: en + examples: + - en url: type: string format: uri - example: https://pokeapi.co/api/v2/language/9/ + examples: + - https://pokeapi.co/api/v2/language/9/ readOnly: true type: $ref: '#/components/schemas/TypeSummary' @@ -5208,11 +5268,13 @@ components: properties: name: type: string - example: fire-punch + examples: + - fire-punch url: type: string format: uri - example: https://pokeapi.co/api/v2/move/7/ + examples: + - https://pokeapi.co/api/v2/move/7/ use_after: type: array nullable: true @@ -5224,11 +5286,13 @@ components: properties: name: type: string - example: ice-punch + examples: + - ice-punch url: type: string format: uri - example: https://pokeapi.co/api/v2/move/8/ + examples: + - https://pokeapi.co/api/v2/move/8/ super: type: object required: @@ -5246,11 +5310,13 @@ components: properties: name: type: string - example: night-slash + examples: + - night-slash url: type: string format: uri - example: https://pokeapi.co/api/v2/move/400/ + examples: + - https://pokeapi.co/api/v2/move/400/ use_after: type: array nullable: true @@ -5262,11 +5328,13 @@ components: properties: name: type: string - example: focus-energy + examples: + - focus-energy url: type: string format: uri - example: https://pokeapi.co/api/v2/move/116/ + examples: + - https://pokeapi.co/api/v2/move/116/ readOnly: true contest_type: $ref: '#/components/schemas/ContestTypeSummary' @@ -5285,10 +5353,12 @@ components: properties: effect: type: string - example: Inflicts [regular damage]{mechanic:regular-damage}. + examples: + - Inflicts [regular damage]{mechanic:regular-damage}. short_effect: type: string - example: Inflicts regular damage with no additional effect. + examples: + - Inflicts regular damage with no additional effect. language: type: object required: @@ -5297,11 +5367,13 @@ components: properties: name: type: string - example: en + examples: + - en url: type: string format: uri - example: https://pokeapi.co/api/v2/language/9/ + examples: + - https://pokeapi.co/api/v2/language/9/ readOnly: true effect_changes: type: array @@ -5321,7 +5393,8 @@ components: properties: effect: type: string - example: Hits Pokémon under the effects of dig and fly. + examples: + - Hits Pokémon under the effects of dig and fly. language: type: object required: @@ -5330,11 +5403,13 @@ components: properties: name: type: string - example: en + examples: + - en url: type: string format: uri - example: https://pokeapi.co/api/v2/language/9/ + examples: + - https://pokeapi.co/api/v2/language/9/ version_group: type: object required: @@ -5343,11 +5418,13 @@ components: properties: name: type: string - example: gold-silver + examples: + - gold-silver url: type: string format: uri - example: https://pokeapi.co/api/v2/version-group/3/ + examples: + - https://pokeapi.co/api/v2/version-group/3/ readOnly: true generation: $ref: '#/components/schemas/GenerationSummary' @@ -5376,7 +5453,8 @@ components: change: type: integer format: int32 - example: 2 + examples: + - 2 stat: type: object required: @@ -5385,11 +5463,13 @@ components: properties: name: type: string - example: attack + examples: + - attack url: type: string format: uri - example: https://pokeapi.co/api/v2/stat/1/ + examples: + - https://pokeapi.co/api/v2/stat/1/ readOnly: true super_contest_effect: $ref: '#/components/schemas/SuperContestEffectSummary' @@ -5413,7 +5493,8 @@ components: url: type: string format: uri - example: https://pokeapi.co/api/v2/machine/1/ + examples: + - https://pokeapi.co/api/v2/machine/1/ version_group: type: object required: @@ -5422,11 +5503,13 @@ components: properties: name: type: string - example: sword-shield + examples: + - sword-shield url: type: string format: uri - example: https://pokeapi.co/api/v2/version-group/1/ + examples: + - https://pokeapi.co/api/v2/version-group/1/ readOnly: true flavor_text_entries: type: array @@ -5443,11 +5526,13 @@ components: properties: name: type: string - example: clefairy + examples: + - clefairy url: type: string format: uri - example: https://pokeapi.co/api/v2/pokemon/35/ + examples: + - https://pokeapi.co/api/v2/pokemon/35/ readOnly: true required: - contest_combos @@ -5522,11 +5607,13 @@ components: properties: name: type: string - example: red-blue + examples: + - red-blue url: type: string format: uri - example: https://pokeapi.co/api/v2/version-group/1/ + examples: + - https://pokeapi.co/api/v2/version-group/1/ readOnly: true required: - descriptions @@ -5647,11 +5734,13 @@ components: properties: name: type: string - example: thunder-punch + examples: + - thunder-punch url: type: string format: uri - example: https://pokeapi.co/api/v2/move/9/ + examples: + - https://pokeapi.co/api/v2/move/9/ readOnly: true names: type: array @@ -5721,11 +5810,13 @@ components: properties: name: type: string - example: sing + examples: + - sing url: type: string format: uri - example: https://pokeapi.co/api/v2/move/47/ + examples: + - https://pokeapi.co/api/v2/move/47/ readOnly: true required: - descriptions @@ -5883,7 +5974,8 @@ components: max_change: type: integer format: int32 - example: 1 + examples: + - 1 pokeathlon_stat: type: object required: @@ -5892,11 +5984,13 @@ components: properties: name: type: string - example: power + examples: + - power url: type: string format: uri - example: https://pokeapi.co/api/v2/pokeathlon-stat/2/ + examples: + - https://pokeapi.co/api/v2/pokeathlon-stat/2/ readOnly: true move_battle_style_preferences: type: array @@ -6929,7 +7023,8 @@ components: base_score: type: integer format: int32 - example: 50 + examples: + - 50 pokemon-species: type: object required: @@ -6938,15 +7033,18 @@ components: properties: name: type: string - example: bulbasaur + examples: + - bulbasaur url: type: string format: uri - example: https://pokeapi.co/api/v2/pokemon-species/1/ + examples: + - https://pokeapi.co/api/v2/pokemon-species/1/ rate: type: integer format: int32 - example: 30 + examples: + - 30 readOnly: true required: - id @@ -7004,7 +7102,8 @@ components: type: integer format: int32 maximum: -1 - example: -1 + examples: + - -1 nature: type: object required: @@ -7013,11 +7112,13 @@ components: properties: name: type: string - example: hardy + examples: + - hardy url: type: string format: uri - example: https://pokeapi.co/api/v2/nature/1/ + examples: + - https://pokeapi.co/api/v2/nature/1/ increase: type: array items: @@ -7030,7 +7131,8 @@ components: type: integer format: int32 minimum: 1 - example: 2 + examples: + - 2 nature: type: object required: @@ -7039,11 +7141,13 @@ components: properties: name: type: string - example: hardy + examples: + - hardy url: type: string format: uri - example: https://pokeapi.co/api/v2/nature/1/ + examples: + - https://pokeapi.co/api/v2/nature/1/ readOnly: true names: type: array @@ -7121,7 +7225,8 @@ components: entry_number: type: integer format: int32 - example: 1 + examples: + - 1 pokemon_species: type: object required: @@ -7130,11 +7235,13 @@ components: properties: name: type: string - example: bulbasaur + examples: + - bulbasaur url: type: string format: uri - example: https://pokeapi.co/api/v2/pokemon-species/1/ + examples: + - https://pokeapi.co/api/v2/pokemon-species/1/ readOnly: true region: $ref: '#/components/schemas/RegionSummary' @@ -7148,11 +7255,13 @@ components: properties: name: type: string - example: the-teal-mask + examples: + - the-teal-mask url: type: string format: uri - example: https://pokeapi.co/api/v2/version-group/26/ + examples: + - https://pokeapi.co/api/v2/version-group/26/ readOnly: true required: - descriptions @@ -7286,18 +7395,20 @@ components: properties: name: type: string - example: sand-veil + examples: + - sand-veil url: type: string format: uri - example: https://pokeapi.co/api/v2/ability/8/ + examples: + - https://pokeapi.co/api/v2/ability/8/ is_hidden: type: boolean - example: false slot: type: integer format: int32 - example: 1 + examples: + - 1 readOnly: true past_abilities: type: array @@ -7324,18 +7435,20 @@ components: properties: name: type: string - example: levitate + examples: + - levitate url: type: string format: uri - example: https://pokeapi.co/api/v2/ability/26/ + examples: + - https://pokeapi.co/api/v2/ability/26/ is_hidden: type: boolean - example: false slot: type: integer format: int32 - example: 1 + examples: + - 1 generation: type: object required: @@ -7344,11 +7457,13 @@ components: properties: name: type: string - example: generation-vi + examples: + - generation-vi url: type: string format: uri - example: https://pokeapi.co/api/v2/generation/6/ + examples: + - https://pokeapi.co/api/v2/generation/6/ readOnly: true forms: type: array @@ -7374,11 +7489,13 @@ components: properties: name: type: string - example: soft-sand + examples: + - soft-sand url: type: string format: uri - example: https://pokeapi.co/api/v2/item/214/ + examples: + - https://pokeapi.co/api/v2/item/214/ version_details: type: array items: @@ -7390,7 +7507,8 @@ components: rarity: type: integer format: int32 - example: 5 + examples: + - 5 version: type: object required: @@ -7399,15 +7517,18 @@ components: properties: name: type: string - example: diamond + examples: + - diamond url: type: string format: uri - example: https://pokeapi.co/api/v2/version/12/ + examples: + - https://pokeapi.co/api/v2/version/12/ readOnly: true location_area_encounters: type: string - example: https://pokeapi.co/api/v2/pokemon/1/encounters + examples: + - https://pokeapi.co/api/v2/pokemon/1/encounters readOnly: true moves: type: array @@ -7425,11 +7546,13 @@ components: properties: name: type: string - example: scratch + examples: + - scratch url: type: string format: uri - example: https://pokeapi.co/api/v2/move/10/ + examples: + - https://pokeapi.co/api/v2/move/10/ version_group_details: type: array items: @@ -7442,7 +7565,8 @@ components: level_learned_at: type: integer format: int32 - example: 1 + examples: + - 1 move_learn_method: type: object required: @@ -7451,11 +7575,13 @@ components: properties: name: type: string - example: level-up + examples: + - level-up url: type: string format: uri - example: https://pokeapi.co/api/v2/move-learn-method/1/ + examples: + - https://pokeapi.co/api/v2/move-learn-method/1/ version_group: type: object required: @@ -7464,11 +7590,13 @@ components: properties: name: type: string - example: red-blue + examples: + - red-blue url: type: string format: uri - example: https://pokeapi.co/api/v2/version-group/1/ + examples: + - https://pokeapi.co/api/v2/version-group/1/ readOnly: true species: $ref: '#/components/schemas/PokemonSpeciesSummary' @@ -7483,9 +7611,10 @@ components: type: string format: uri nullable: true - example: https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/1.png - example: - back_default: https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/1.png + examples: + - https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/1.png + examples: + - back_default: https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/1.png back_female: null back_shiny: https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/1.png back_shiny_female: null @@ -7503,11 +7632,13 @@ components: latest: type: string format: uri - example: https://raw.githubusercontent.com/PokeAPI/cries/main/cries/pokemon/latest/50.ogg + examples: + - https://raw.githubusercontent.com/PokeAPI/cries/main/cries/pokemon/latest/50.ogg legacy: type: string format: uri - example: https://raw.githubusercontent.com/PokeAPI/cries/main/cries/pokemon/legacy/50.ogg + examples: + - https://raw.githubusercontent.com/PokeAPI/cries/main/cries/pokemon/legacy/50.ogg readOnly: true stats: type: array @@ -7525,7 +7656,8 @@ components: slot: type: integer format: int32 - example: 1 + examples: + - 1 type: type: object required: @@ -7534,11 +7666,13 @@ components: properties: name: type: string - example: ghost + examples: + - ghost url: type: string format: uri - example: https://pokeapi.co/api/v2/type/8/ + examples: + - https://pokeapi.co/api/v2/type/8/ readOnly: true past_types: type: array @@ -7556,11 +7690,13 @@ components: properties: name: type: string - example: generation-v + examples: + - generation-v url: type: string format: uri - example: https://pokeapi.co/api/v2/generation/5/ + examples: + - https://pokeapi.co/api/v2/generation/5/ types: type: array items: @@ -7572,7 +7708,8 @@ components: slot: type: integer format: int32 - example: 1 + examples: + - 1 type: type: object required: @@ -7581,11 +7718,13 @@ components: properties: name: type: string - example: normal + examples: + - normal url: type: string format: uri - example: https://pokeapi.co/api/v2/type/1/ + examples: + - https://pokeapi.co/api/v2/type/1/ readOnly: true required: - abilities @@ -7651,14 +7790,16 @@ components: default: type: string format: uri - example: https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/412.png + examples: + - https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/412.png additionalProperties: type: string format: uri nullable: true - example: https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/412.png - example: - back_default: https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/412.png + examples: + - https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/412.png + examples: + - back_default: https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/412.png back_female: null back_shiny: https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/412.png back_shiny_female: null @@ -7685,14 +7826,17 @@ components: properties: name: type: string - example: en + examples: + - en url: type: string format: uri - example: https://pokeapi.co/api/v2/language/9/ + examples: + - https://pokeapi.co/api/v2/language/9/ name: type: string - example: Plant Cloak + examples: + - Plant Cloak readOnly: true names: type: array @@ -7710,14 +7854,17 @@ components: properties: name: type: string - example: en + examples: + - en url: type: string format: uri - example: https://pokeapi.co/api/v2/language/9/ + examples: + - https://pokeapi.co/api/v2/language/9/ name: type: string - example: Plant Cloak + examples: + - Plant Cloak readOnly: true types: type: array @@ -7730,7 +7877,8 @@ components: slot: type: integer format: int32 - example: 1 + examples: + - 1 type: type: object required: @@ -7739,11 +7887,13 @@ components: properties: name: type: string - example: bug + examples: + - bug url: type: string format: uri - example: https://pokeapi.co/api/v2/type/7/ + examples: + - https://pokeapi.co/api/v2/type/7/ readOnly: true required: - form_name @@ -7847,7 +7997,8 @@ components: properties: awesome_name: type: string - example: Pomaceous + examples: + - Pomaceous language: type: object required: @@ -7856,11 +8007,13 @@ components: properties: name: type: string - example: en + examples: + - en url: type: string format: uri - example: https://pokeapi.co/api/v2/language/9/ + examples: + - https://pokeapi.co/api/v2/language/9/ readOnly: true names: type: array @@ -7873,10 +8026,12 @@ components: url: type: string format: uri - example: https://pokeapi.co/api/v2/language/9/ + examples: + - https://pokeapi.co/api/v2/language/9/ name: type: string - example: Ball + examples: + - Ball readOnly: true pokemon_species: type: array @@ -7978,11 +8133,13 @@ components: properties: name: type: string - example: monster + examples: + - monster url: type: string format: uri - example: https://pokeapi.co/api/v2/egg-group/1/ + examples: + - https://pokeapi.co/api/v2/egg-group/1/ readOnly: true color: $ref: '#/components/schemas/PokemonColorSummary' @@ -8012,14 +8169,17 @@ components: properties: name: type: string - example: en + examples: + - en url: type: string format: uri - example: https://pokeapi.co/api/v2/language/9/ + examples: + - https://pokeapi.co/api/v2/language/9/ name: type: string - example: bulbasaur + examples: + - bulbasaur readOnly: true pal_park_encounters: type: array @@ -8038,19 +8198,23 @@ components: properties: name: type: string - example: field + examples: + - field url: type: string format: uri - example: https://pokeapi.co/api/v2/pal-park-area/2/ + examples: + - https://pokeapi.co/api/v2/pal-park-area/2/ base_score: type: integer format: int32 - example: 50 + examples: + - 50 rate: type: integer format: int32 - example: 30 + examples: + - 30 readOnly: true form_descriptions: type: array @@ -8072,7 +8236,8 @@ components: properties: genus: type: string - example: Seed Pokémon + examples: + - Seed Pokémon language: type: object required: @@ -8081,11 +8246,13 @@ components: properties: name: type: string - example: en + examples: + - en url: type: string format: uri - example: https://pokeapi.co/api/v2/language/9/ + examples: + - https://pokeapi.co/api/v2/language/9/ readOnly: true varieties: type: array @@ -8097,7 +8264,6 @@ components: properties: is_default: type: boolean - example: true pokemon: type: object required: @@ -8106,11 +8272,13 @@ components: properties: name: type: string - example: bulbasaur + examples: + - bulbasaur url: type: string format: uri - example: https://pokeapi.co/api/v2/pokemon/1/ + examples: + - https://pokeapi.co/api/v2/pokemon/1/ readOnly: true required: - color @@ -8224,11 +8392,13 @@ components: properties: name: type: string - example: red-blue + examples: + - red-blue url: type: string format: uri - example: https://pokeapi.co/api/v2/version-group/1/ + examples: + - https://pokeapi.co/api/v2/version-group/1/ readOnly: true required: - id @@ -8294,7 +8464,8 @@ components: change: type: integer format: int32 - example: -1 + examples: + - -1 move: type: object required: @@ -8303,11 +8474,13 @@ components: properties: name: type: string - example: swords-dance + examples: + - swords-dance url: type: string format: uri - example: https://pokeapi.co/api/v2/move/14/ + examples: + - https://pokeapi.co/api/v2/move/14/ decrease: type: array items: @@ -8319,7 +8492,8 @@ components: change: type: integer format: int32 - example: 5 + examples: + - 5 move: type: object required: @@ -8328,11 +8502,13 @@ components: properties: name: type: string - example: growl + examples: + - growl url: type: string format: uri - example: https://pokeapi.co/api/v2/move/45/ + examples: + - https://pokeapi.co/api/v2/move/45/ readOnly: true affecting_natures: type: object @@ -8350,11 +8526,13 @@ components: properties: name: type: string - example: lonely + examples: + - lonely url: type: string format: uri - example: https://pokeapi.co/api/v2/nature/6/ + examples: + - https://pokeapi.co/api/v2/nature/6/ decrease: type: array items: @@ -8365,11 +8543,13 @@ components: properties: name: type: string - example: bold + examples: + - bold url: type: string format: uri - example: https://pokeapi.co/api/v2/nature/2/ + examples: + - https://pokeapi.co/api/v2/nature/2/ readOnly: true characteristics: type: array @@ -8491,11 +8671,13 @@ components: properties: name: type: string - example: flying + examples: + - flying url: type: string format: uri - example: https://pokeapi.co/api/v2/type/3/ + examples: + - https://pokeapi.co/api/v2/type/3/ half_damage_to: type: array items: @@ -8506,11 +8688,13 @@ components: properties: name: type: string - example: bug + examples: + - bug url: type: string format: uri - example: https://pokeapi.co/api/v2/type/7/ + examples: + - https://pokeapi.co/api/v2/type/7/ double_damage_to: type: array items: @@ -8521,11 +8705,13 @@ components: properties: name: type: string - example: poison + examples: + - poison url: type: string format: uri - example: https://pokeapi.co/api/v2/type/4/ + examples: + - https://pokeapi.co/api/v2/type/4/ no_damage_from: type: array items: @@ -8536,11 +8722,13 @@ components: properties: name: type: string - example: electric + examples: + - electric url: type: string format: uri - example: https://pokeapi.co/api/v2/type/13/ + examples: + - https://pokeapi.co/api/v2/type/13/ half_damage_from: type: array items: @@ -8551,11 +8739,13 @@ components: properties: name: type: string - example: poison + examples: + - poison url: type: string format: uri - example: https://pokeapi.co/api/v2/type/4/ + examples: + - https://pokeapi.co/api/v2/type/4/ double_damage_from: type: array items: @@ -8566,11 +8756,13 @@ components: properties: name: type: string - example: water + examples: + - water url: type: string format: uri - example: https://pokeapi.co/api/v2/type/11/ + examples: + - https://pokeapi.co/api/v2/type/11/ readOnly: true past_damage_relations: type: array @@ -8588,11 +8780,13 @@ components: properties: name: type: string - example: generation-v + examples: + - generation-v url: type: string format: uri - example: https://pokeapi.co/api/v2/generation/5/ + examples: + - https://pokeapi.co/api/v2/generation/5/ damage_relations: type: object required: @@ -8613,11 +8807,13 @@ components: properties: name: type: string - example: flying + examples: + - flying url: type: string format: uri - example: https://pokeapi.co/api/v2/type/3/ + examples: + - https://pokeapi.co/api/v2/type/3/ half_damage_to: type: array items: @@ -8628,11 +8824,13 @@ components: properties: name: type: string - example: bug + examples: + - bug url: type: string format: uri - example: https://pokeapi.co/api/v2/type/7/ + examples: + - https://pokeapi.co/api/v2/type/7/ double_damage_to: type: array items: @@ -8643,11 +8841,13 @@ components: properties: name: type: string - example: poison + examples: + - poison url: type: string format: uri - example: https://pokeapi.co/api/v2/type/4/ + examples: + - https://pokeapi.co/api/v2/type/4/ no_damage_from: type: array items: @@ -8658,11 +8858,13 @@ components: properties: name: type: string - example: electric + examples: + - electric url: type: string format: uri - example: https://pokeapi.co/api/v2/type/13/ + examples: + - https://pokeapi.co/api/v2/type/13/ half_damage_from: type: array items: @@ -8673,11 +8875,13 @@ components: properties: name: type: string - example: poison + examples: + - poison url: type: string format: uri - example: https://pokeapi.co/api/v2/type/4/ + examples: + - https://pokeapi.co/api/v2/type/4/ double_damage_from: type: array items: @@ -8688,11 +8892,13 @@ components: properties: name: type: string - example: water + examples: + - water url: type: string format: uri - example: https://pokeapi.co/api/v2/type/11/ + examples: + - https://pokeapi.co/api/v2/type/11/ readOnly: true game_indices: type: array @@ -8718,7 +8924,8 @@ components: properties: slot: type: integer - example: 1 + examples: + - 1 pokemon: type: object require: @@ -8728,12 +8935,14 @@ components: name: type: string description: The name of the pokemon - example: sandshrew + examples: + - sandshrew url: type: string format: uri description: The URL to get more information about the pokemon - example: https://pokeapi.co/api/v2/pokemon/27/ + examples: + - https://pokeapi.co/api/v2/pokemon/27/ readOnly: true moves: type: array @@ -8828,11 +9037,13 @@ components: properties: name: type: string - example: level-up + examples: + - level-up url: type: string format: uri - example: https://pokeapi.co/api/v2/move-learn-method/1/ + examples: + - https://pokeapi.co/api/v2/move-learn-method/1/ readOnly: true pokedexes: type: array @@ -8844,11 +9055,13 @@ components: properties: name: type: string - example: kanto + examples: + - kanto url: type: string format: uri - example: https://pokeapi.co/api/v2/pokedex/2/ + examples: + - https://pokeapi.co/api/v2/pokedex/2/ readOnly: true regions: type: array @@ -8860,11 +9073,13 @@ components: properties: name: type: string - example: kanto + examples: + - kanto url: type: string format: uri - example: https://pokeapi.co/api/v2/region/1/ + examples: + - https://pokeapi.co/api/v2/region/1/ readOnly: true versions: type: array diff --git a/pokemon_v2/api.py b/pokemon_v2/api.py index ba2a0ef52..7154aeead 100644 --- a/pokemon_v2/api.py +++ b/pokemon_v2/api.py @@ -142,7 +142,7 @@ class BerryFlavorResource(PokeapiCommonViewset): @extend_schema( description="Characteristics indicate which stat contains a Pokémon's highest IV. A Pokémon's Characteristic is determined by the remainder of its highest IV divided by 5 (gene_modulo). Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Characteristic) for greater detail.", - summary="Get charecterictic", + summary="Get characteristic", tags=["pokemon"], ) @extend_schema_view( diff --git a/pokemon_v2/serializers.py b/pokemon_v2/serializers.py index 47e195090..f2213c320 100644 --- a/pokemon_v2/serializers.py +++ b/pokemon_v2/serializers.py @@ -484,7 +484,9 @@ class Meta: "items": { "type": "integer", "format": "int32", }, - "example": [0, 5, 10, 15, 20, 25, 30], + "examples": [ + [0, 5, 10, 15, 20, 25, 30] + ] } ) def get_values(self, obj): @@ -626,11 +628,11 @@ class Meta: "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "red-blue"}, + "name": {"type": "string", "examples": [ "red-blue" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/version-group/1/", + "examples": [ "https://pokeapi.co/api/v2/version-group/1/" ], }, }, }, @@ -710,16 +712,16 @@ class Meta: "type": "object", "required": ["rate", "pokemon_species"], "properties": { - "rate": {"type": "integer", "format": "int32", "example": 1}, + "rate": {"type": "integer", "format": "int32", "examples": [ 1 ]}, "pokemon_species": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "bulbasaur"}, + "name": {"type": "string", "examples": [ "bulbasaur" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/pokemon-species/1/", + "examples": [ "https://pokeapi.co/api/v2/pokemon-species/1/" ], }, }, }, @@ -756,11 +758,11 @@ def get_species(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "wormadam"}, + "name": {"type": "string", "examples": [ "wormadam" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/pokemon-species/413/", + "examples": [ "https://pokeapi.co/api/v2/pokemon-species/413/" ], }, }, }, @@ -986,11 +988,11 @@ class Meta: "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "old-rod"}, + "name": {"type": "string", "examples": [ "old-rod" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/encounter-method/2/", + "examples": [ "https://pokeapi.co/api/v2/encounter-method/2/" ], }, }, }, @@ -1000,19 +1002,19 @@ class Meta: "type": "object", "required": ["rate", "version"], "properties": { - "rate": {"type": "integer", "format": "int32", "example": 5}, + "rate": {"type": "integer", "format": "int32", "examples": [ 5 ]}, "version": { "type": "object", "required": ["name", "url"], "properties": { "name": { "type": "string", - "example": "platinum", + "examples": [ "platinum" ], }, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/version/14/", + "examples": [ "https://pokeapi.co/api/v2/version/14/" ], }, }, }, @@ -1075,11 +1077,11 @@ def get_method_rates(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "tentacool"}, + "name": {"type": "string", "examples": [ "tentacool" ]}, "url": { "type": "string", "format": "uri", - "example": "ttps://pokeapi.co/api/v2/pokemon/72/", + "examples": [ "https://pokeapi.co/api/v2/pokemon/72/" ], }, }, }, @@ -1095,16 +1097,16 @@ def get_method_rates(self, obj): "properties": { "name": { "type": "string", - "example": "diamond", + "examples": [ "diamond" ], }, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/version/12/", + "examples": [ "https://pokeapi.co/api/v2/version/12/" ], }, }, }, - "max_chance": {"type": "integer", "format": "int32", "example": 60}, + "max_chance": {"type": "integer", "format": "int32", "examples": [ 60 ]}, "encounter_details": { "type": "object", "required": [ @@ -1115,36 +1117,36 @@ def get_method_rates(self, obj): "method", ], "properties": { - "min_level": {"type": "integer", "format": "int32", "example": 20}, - "max_level": {"type": "integer", "format": "int32", "example": 30}, + "min_level": {"type": "integer", "format": "int32", "examples": [ 20 ]}, + "max_level": {"type": "integer", "format": "int32", "examples": [ 30 ]}, "condition_values": { "type": "object", "required": ["name", "url"], "properties": { "name": { "type": "string", - "example": "slot2-sapphire", + "examples": [ "slot2-sapphire" ], }, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/encounter-condition-value/10/", + "examples": [ "https://pokeapi.co/api/v2/encounter-condition-value/10/" ], }, }, }, - "chance": {"type": "integer", "format": "int32", "example": 60}, + "chance": {"type": "integer", "format": "int32", "examples": [ 60 ]}, "method": { "type": "object", "required": ["name", "url"], "properties": { "name": { "type": "string", - "example": "surf", + "examples": [ "surf" ], }, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/encounter-method/5/", + "examples": [ "https://pokeapi.co/api/v2/encounter-method/5/" ], }, }, }, @@ -1335,17 +1337,17 @@ class Meta: "type": "object", "required": ["is_hidden", "slot", "pokemon"], "properties": { - "is_hidden": {"type": "boolean", "example": True}, - "slot": {"type": "integer", "format": "int32", "example": 3}, + "is_hidden": {"type": "boolean"}, + "slot": {"type": "integer", "format": "int32", "examples": [ 3 ]}, "pokemon": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "gloom"}, + "name": {"type": "string", "examples": [ "gloom" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/pokemon/44/", + "examples": [ "https://pokeapi.co/api/v2/pokemon/44/" ], }, }, }, @@ -1414,19 +1416,19 @@ class Meta: "type": "object", "required": ["change", "move"], "properties": { - "change": {"type": "integer", "format": "int32", "example": -1}, + "change": {"type": "integer", "format": "int32", "examples": [ -1 ]}, "move": { "type": "object", "required": ["name", "url"], "properties": { "name": { "type": "string", - "example": "swords-dance", + "examples": [ "swords-dance" ], }, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/move/14/", + "examples": [ "https://pokeapi.co/api/v2/move/14/" ], }, }, }, @@ -1439,16 +1441,16 @@ class Meta: "type": "object", "required": ["change", "move"], "properties": { - "change": {"type": "integer", "format": "int32", "example": 5}, + "change": {"type": "integer", "format": "int32", "examples": [ 5 ]}, "move": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "growl"}, + "name": {"type": "string", "examples": [ "growl" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/move/45/", + "examples": [ "https://pokeapi.co/api/v2/move/45/" ], }, }, }, @@ -1485,11 +1487,11 @@ def get_moves_that_affect(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "lonely"}, + "name": {"type": "string", "examples": [ "lonely" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/nature/6/", + "examples": [ "https://pokeapi.co/api/v2/nature/6/" ], }, }, }, @@ -1500,11 +1502,11 @@ def get_moves_that_affect(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "bold"}, + "name": {"type": "string", "examples": [ "bold" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/nature/2/", + "examples": [ "https://pokeapi.co/api/v2/nature/2/" ], }, }, }, @@ -1613,11 +1615,11 @@ class Meta: "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "master-ball"}, + "name": {"type": "string", "examples": [ "master-ball" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/item/1/", + "examples": [ "https://pokeapi.co/api/v2/item/1/" ], }, }, }, @@ -1749,17 +1751,17 @@ class Meta: "machine": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/machine/1/", + "examples": [ "https://pokeapi.co/api/v2/machine/1/" ], }, "version_group": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "sword-shield"}, + "name": {"type": "string", "examples": [ "sword-shield" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/version-group/20/", + "examples": [ "https://pokeapi.co/api/v2/version-group/20/" ], }, }, }, @@ -1795,7 +1797,7 @@ def get_item_machines(self, obj): "default": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/media/sprites/items/master-ball.png", + "examples": [ "https://pokeapi.co/media/sprites/items/master-ball.png" ], } }, } @@ -1811,11 +1813,11 @@ def get_item_sprites(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "countable"}, + "name": {"type": "string", "examples": [ "countable" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/item-attribute/1/", + "examples": [ "https://pokeapi.co/api/v2/item-attribute/1/" ], }, }, }, @@ -1849,11 +1851,11 @@ def get_item_attributes(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "farfetchd"}, + "name": {"type": "string", "examples": [ "farfetchd" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/pokemon/83/", + "examples": [ "https://pokeapi.co/api/v2/pokemon/83/" ], }, }, }, @@ -1863,16 +1865,16 @@ def get_item_attributes(self, obj): "type": "object", "required": ["rarity", "version"], "properties": { - "rarity": {"type": "integer", "format": "int32", "example": 5}, + "rarity": {"type": "integer", "format": "int32", "examples": [ 5 ]}, "version": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "ruby"}, + "name": {"type": "string", "examples": [ "ruby" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/version/7/", + "examples": [ "https://pokeapi.co/api/v2/version/7/" ], }, }, }, @@ -1923,7 +1925,7 @@ def get_held_by_pokemon(self, obj): "url": { "type": "string", "format": "uri", - "example": '"https://pokeapi.co/api/v2/evolution-chain/51/', + "examples": [ "https://pokeapi.co/api/v2/evolution-chain/51/" ], } }, } @@ -1999,16 +2001,16 @@ class Meta: "type": "object", "required": ["max_change", "pokeathlon_stat"], "properties": { - "max_change": {"type": "integer", "format": "int32", "example": 1}, + "max_change": {"type": "integer", "format": "int32", "examples": [ 1 ]}, "pokeathlon_stat": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "power"}, + "name": {"type": "string", "examples": [ "power" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/pokeathlon-stat/2/", + "examples": [ "https://pokeapi.co/api/v2/pokeathlon-stat/2/" ], }, }, }, @@ -2078,7 +2080,7 @@ class Meta: "type": "object", "required": ["potency", "berry"], "properties": { - "potency": {"type": "integer", "example": 10}, + "potency": {"type": "integer", "examples": [ 10 ]}, "berry": { "type": "object", "require": ["name", "url"], @@ -2086,13 +2088,13 @@ class Meta: "name": { "type": "string", "description": "The name of the berry", - "example": "rowap", + "examples": [ "rowap" ], }, "url": { "type": "string", "format": "uri", "description": "The URL to get more information about the berry", - "example": "https://pokeapi.co/api/v2/berry/64/", + "examples": [ "https://pokeapi.co/api/v2/berry/64/" ], }, }, }, @@ -2144,7 +2146,7 @@ class Meta: "type": "object", "required": ["potency", "flavor"], "properties": { - "potency": {"type": "integer", "example": 10}, + "potency": {"type": "integer", "examples": [ 10 ]}, "flavor": { "type": "object", "require": ["name", "url"], @@ -2152,13 +2154,13 @@ class Meta: "name": { "type": "string", "description": "The name of the flavor", - "example": "spicy", + "examples": [ "spicy" ], }, "url": { "type": "string", "format": "uri", "description": "The URL to get more information about the flavor", - "example": "https://pokeapi.co/api/v2/berry-flavor/1/", + "examples": [ "https://pokeapi.co/api/v2/berry-flavor/1/" ], }, }, }, @@ -2218,13 +2220,13 @@ class Meta: "name": { "type": "string", "description": "Pokemon species name.", - "example": "bulbasaur", + "examples": [ "bulbasaur" ], }, "url": { "type": "string", "format": "uri", "description": "The URL to get more information about the species", - "example": "https://pokeapi.co/api/v2/pokemon-species/1/", + "examples": [ "https://pokeapi.co/api/v2/pokemon-species/1/" ], }, }, }, @@ -2342,11 +2344,11 @@ def add_type_entry(self, relations, type, damage_factor, direction="_damage_to") "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "flying"}, + "name": {"type": "string", "examples": [ "flying" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/type/3/", + "examples": [ "https://pokeapi.co/api/v2/type/3/" ], }, }, }, @@ -2357,11 +2359,11 @@ def add_type_entry(self, relations, type, damage_factor, direction="_damage_to") "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "bug"}, + "name": {"type": "string", "examples": [ "bug" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/type/7/", + "examples": [ "https://pokeapi.co/api/v2/type/7/" ], }, }, }, @@ -2372,11 +2374,11 @@ def add_type_entry(self, relations, type, damage_factor, direction="_damage_to") "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "poison"}, + "name": {"type": "string", "examples": [ "poison" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/type/4/", + "examples": [ "https://pokeapi.co/api/v2/type/4/" ], }, }, }, @@ -2387,11 +2389,11 @@ def add_type_entry(self, relations, type, damage_factor, direction="_damage_to") "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "electric"}, + "name": {"type": "string", "examples": [ "electric" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/type/13/", + "examples": [ "https://pokeapi.co/api/v2/type/13/" ], }, }, }, @@ -2402,11 +2404,11 @@ def add_type_entry(self, relations, type, damage_factor, direction="_damage_to") "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "poison"}, + "name": {"type": "string", "examples": [ "poison" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/type/4/", + "examples": [ "https://pokeapi.co/api/v2/type/4/" ], }, }, }, @@ -2417,11 +2419,11 @@ def add_type_entry(self, relations, type, damage_factor, direction="_damage_to") "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "water"}, + "name": {"type": "string", "examples": [ "water" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/type/11/", + "examples": [ "https://pokeapi.co/api/v2/type/11/" ], }, }, }, @@ -2504,11 +2506,11 @@ def remove_type_entry(self, relations, type, direction="_damage_to"): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "generation-v"}, + "name": {"type": "string", "examples": [ "generation-v" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/generation/5/", + "examples": [ "https://pokeapi.co/api/v2/generation/5/" ], }, }, }, @@ -2529,11 +2531,11 @@ def remove_type_entry(self, relations, type, direction="_damage_to"): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "flying"}, + "name": {"type": "string", "examples": [ "flying" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/type/3/", + "examples": [ "https://pokeapi.co/api/v2/type/3/" ], }, }, }, @@ -2544,11 +2546,11 @@ def remove_type_entry(self, relations, type, direction="_damage_to"): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "bug"}, + "name": {"type": "string", "examples": [ "bug" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/type/7/", + "examples": [ "https://pokeapi.co/api/v2/type/7/" ], }, }, }, @@ -2559,11 +2561,11 @@ def remove_type_entry(self, relations, type, direction="_damage_to"): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "poison"}, + "name": {"type": "string", "examples": [ "poison" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/type/4/", + "examples": [ "https://pokeapi.co/api/v2/type/4/" ], }, }, }, @@ -2576,12 +2578,12 @@ def remove_type_entry(self, relations, type, direction="_damage_to"): "properties": { "name": { "type": "string", - "example": "electric", + "examples": [ "electric" ], }, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/type/13/", + "examples": [ "https://pokeapi.co/api/v2/type/13/" ], }, }, }, @@ -2592,11 +2594,11 @@ def remove_type_entry(self, relations, type, direction="_damage_to"): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "poison"}, + "name": {"type": "string", "examples": [ "poison" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/type/4/", + "examples": [ "https://pokeapi.co/api/v2/type/4/" ], }, }, }, @@ -2607,11 +2609,11 @@ def remove_type_entry(self, relations, type, direction="_damage_to"): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "water"}, + "name": {"type": "string", "examples": [ "water" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/type/11/", + "examples": [ "https://pokeapi.co/api/v2/type/11/" ], }, }, }, @@ -2723,7 +2725,7 @@ def type_is_present(self, type, current_gen): "type": "object", "required": ["potency", "flavor"], "properties": { - "slot": {"type": "integer", "example": 1}, + "slot": {"type": "integer", "examples": [ 1 ]}, "pokemon": { "type": "object", "require": ["name", "url"], @@ -2731,13 +2733,13 @@ def type_is_present(self, type, current_gen): "name": { "type": "string", "description": "The name of the pokemon", - "example": "sandshrew", + "examples": [ "sandshrew" ], }, "url": { "type": "string", "format": "uri", "description": "The URL to get more information about the pokemon", - "example": "https://pokeapi.co/api/v2/pokemon/27/", + "examples": [ "https://pokeapi.co/api/v2/pokemon/27/" ], }, }, }, @@ -2858,11 +2860,11 @@ class Meta: "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "thunder-punch"}, + "name": {"type": "string", "examples": [ "thunder-punch" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/move/9/", + "examples": [ "https://pokeapi.co/api/v2/move/9/" ], }, }, }, @@ -2905,11 +2907,11 @@ class Meta: "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "sing"}, + "name": {"type": "string", "examples": [ "sing" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/move/47/", + "examples": [ "https://pokeapi.co/api/v2/move/47/" ], }, }, }, @@ -3018,21 +3020,21 @@ class Meta: "properties": { "effect": { "type": "string", - "example": "Inflicts [regular damage]{mechanic:regular-damage}.", + "examples": [ "Inflicts [regular damage]{mechanic:regular-damage}." ], }, "short_effect": { "type": "string", - "example": "Inflicts regular damage with no additional effect.", + "examples": [ "Inflicts regular damage with no additional effect." ], }, "language": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "en"}, + "name": {"type": "string", "examples": [ "en" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/language/9/", + "examples": [ "https://pokeapi.co/api/v2/language/9/" ], }, }, }, @@ -3144,11 +3146,11 @@ class Meta: "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "clefairy"}, + "name": {"type": "string", "examples": [ "clefairy" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/pokemon/35/", + "examples": [ "https://pokeapi.co/api/v2/pokemon/35/" ], }, }, }, @@ -3185,7 +3187,7 @@ def get_learned_by_pokemon(self, obj): "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/machine/1/", + "examples": [ "https://pokeapi.co/api/v2/machine/1/" ], } }, }, @@ -3193,11 +3195,11 @@ def get_learned_by_pokemon(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "sword-shield"}, + "name": {"type": "string", "examples": [ "sword-shield" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/version-group/1/", + "examples": [ "https://pokeapi.co/api/v2/version-group/1/" ], }, }, }, @@ -3241,11 +3243,11 @@ def get_move_machines(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "fire-punch"}, + "name": {"type": "string", "examples": [ "fire-punch" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/move/7/", + "examples": [ "https://pokeapi.co/api/v2/move/7/" ], }, }, }, @@ -3257,11 +3259,11 @@ def get_move_machines(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "ice-punch"}, + "name": {"type": "string", "examples": [ "ice-punch" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/move/8/", + "examples": [ "https://pokeapi.co/api/v2/move/8/" ], }, }, }, @@ -3281,12 +3283,12 @@ def get_move_machines(self, obj): "properties": { "name": { "type": "string", - "example": "night-slash", + "examples": [ "night-slash" ], }, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/move/400/", + "examples": [ "https://pokeapi.co/api/v2/move/400/" ], }, }, }, @@ -3300,12 +3302,12 @@ def get_move_machines(self, obj): "properties": { "name": { "type": "string", - "example": "focus-energy", + "examples": [ "focus-energy" ], }, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/move/116/", + "examples": [ "https://pokeapi.co/api/v2/move/116/" ], }, }, }, @@ -3381,21 +3383,21 @@ def get_combos(self, obj): "properties": { "effect": { "type": "string", - "example": "Inflicts [regular damage]{mechanic:regular-damage}.", + "examples": [ "Inflicts [regular damage]{mechanic:regular-damage}." ], }, "short_effect": { "type": "string", - "example": "Inflicts regular damage with no additional effect.", + "examples": [ "Inflicts regular damage with no additional effect." ], }, "language": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "en"}, + "name": {"type": "string", "examples": [ "en" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/language/9/", + "examples": [ "https://pokeapi.co/api/v2/language/9/" ], }, }, }, @@ -3432,17 +3434,17 @@ def get_effect_text(self, obj): "properties": { "effect": { "type": "string", - "example": "Hits Pokémon under the effects of dig and fly.", + "examples": [ "Hits Pokémon under the effects of dig and fly." ], }, "language": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "en"}, + "name": {"type": "string", "examples": [ "en" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/language/9/", + "examples": [ "https://pokeapi.co/api/v2/language/9/" ], }, }, }, @@ -3453,11 +3455,11 @@ def get_effect_text(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "gold-silver"}, + "name": {"type": "string", "examples": [ "gold-silver" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/version-group/3/", + "examples": [ "https://pokeapi.co/api/v2/version-group/3/" ], }, }, }, @@ -3480,16 +3482,16 @@ def get_effect_change_text(self, obj): "type": "object", "required": ["change", "stat"], "properties": { - "change": {"type": "integer", "format": "int32", "example": 2}, + "change": {"type": "integer", "format": "int32", "examples": [ 2 ]}, "stat": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "attack"}, + "name": {"type": "string", "examples": [ "attack" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/stat/1/", + "examples": [ "https://pokeapi.co/api/v2/stat/1/" ], }, }, }, @@ -3548,20 +3550,20 @@ class Meta: "type": "object", "required": ["base_score", "pokemon-species", "rate"], "properties": { - "base_score": {"type": "integer", "format": "int32", "example": 50}, + "base_score": {"type": "integer", "format": "int32", "examples": [ 50 ]}, "pokemon-species": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "bulbasaur"}, + "name": {"type": "string", "examples": [ "bulbasaur" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/pokemon-species/1/", + "examples": [ "https://pokeapi.co/api/v2/pokemon-species/1/" ], }, }, }, - "rate": {"type": "integer", "format": "int32", "example": 30}, + "rate": {"type": "integer", "format": "int32", "examples": [ 30 ]}, }, }, } @@ -3661,15 +3663,15 @@ class Meta: "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "en"}, + "name": {"type": "string", "examples": [ "en" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/language/9/", + "examples": [ "https://pokeapi.co/api/v2/language/9/" ], }, }, }, - "name": {"type": "string", "example": "Plant Cloak"}, + "name": {"type": "string", "examples": [ "Plant Cloak" ]}, }, }, } @@ -3700,15 +3702,15 @@ def get_pokemon_form_names(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "en"}, + "name": {"type": "string", "examples": [ "en" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/language/9/", + "examples": [ "https://pokeapi.co/api/v2/language/9/" ], }, }, }, - "name": {"type": "string", "example": "Plant Cloak"}, + "name": {"type": "string", "examples": [ "Plant Cloak" ]}, }, }, } @@ -3736,16 +3738,16 @@ def get_pokemon_form_pokemon_names(self, obj): "default": { "type": "string", "format": "uri", - "example": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/412.png", + "examples": [ "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/412.png" ], } }, "additionalProperties": { # Stoplight Elements doesn't render this well "type": "string", "format": "uri", "nullable": True, - "example": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/412.png", + "examples": [ "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/412.png" ], }, - "example": { + "examples": [ { "back_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/412.png", "back_female": None, "back_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/412.png", @@ -3754,7 +3756,7 @@ def get_pokemon_form_pokemon_names(self, obj): "front_female": None, "front_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/shiny/412.png", "front_shiny_female": None, - }, + } ], } ) def get_pokemon_form_sprites(self, obj): @@ -3768,16 +3770,16 @@ def get_pokemon_form_sprites(self, obj): "type": "object", "required": ["slot", "type"], "properties": { - "slot": {"type": "integer", "format": "int32", "example": 1}, + "slot": {"type": "integer", "format": "int32", "examples": [ 1 ]}, "type": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "bug"}, + "name": {"type": "string", "examples": [ "bug" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/type/7/", + "examples": [ "https://pokeapi.co/api/v2/type/7/" ], }, }, }, @@ -3881,11 +3883,11 @@ class Meta: "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "red-blue"}, + "name": {"type": "string", "examples": [ "red-blue" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/version-group/1/", + "examples": [ "https://pokeapi.co/api/v2/version-group/1/" ], }, }, }, @@ -3945,9 +3947,9 @@ class Meta: "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/language/9/", + "examples": [ "https://pokeapi.co/api/v2/language/9/" ], }, - "name": {"type": "string", "example": "Ball"}, + "name": {"type": "string", "examples": [ "Ball" ]}, }, }, } @@ -3987,16 +3989,16 @@ def get_shape_names(self, obj): "type": "object", "required": ["awesome_name", "language"], "properties": { - "awesome_name": {"type": "string", "example": "Pomaceous"}, + "awesome_name": {"type": "string", "examples": [ "Pomaceous" ]}, "language": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "en"}, + "name": {"type": "string", "examples": [ "en" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/language/9/", + "examples": [ "https://pokeapi.co/api/v2/language/9/" ], }, }, }, @@ -4111,9 +4113,9 @@ class Meta: "type": "string", "format": "uri", "nullable": True, - "example": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/1.png", + "examples": [ "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/1.png" ], }, - "example": { + "examples": [ { "back_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/1.png", "back_female": None, "back_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/1.png", @@ -4122,7 +4124,7 @@ class Meta: "front_female": None, "front_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/shiny/1.png", "front_shiny_female": None, - }, + } ], } ) def get_pokemon_sprites(self, obj): @@ -4137,12 +4139,12 @@ def get_pokemon_sprites(self, obj): "latest": { "type": "string", "format": "uri", - "example": "https://raw.githubusercontent.com/PokeAPI/cries/main/cries/pokemon/latest/50.ogg", + "examples": [ "https://raw.githubusercontent.com/PokeAPI/cries/main/cries/pokemon/latest/50.ogg" ], }, "legacy": { "type": "string", "format": "uri", - "example": "https://raw.githubusercontent.com/PokeAPI/cries/main/cries/pokemon/legacy/50.ogg", + "examples": [ "https://raw.githubusercontent.com/PokeAPI/cries/main/cries/pokemon/legacy/50.ogg" ], }, }, } @@ -4429,11 +4431,11 @@ def get_pokemon_cries(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "scratch"}, + "name": {"type": "string", "examples": [ "scratch" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/move/10/", + "examples": [ "https://pokeapi.co/api/v2/move/10/" ], }, }, }, @@ -4447,19 +4449,19 @@ def get_pokemon_cries(self, obj): "version_group", ], "properties": { - "level_learned_at": {"type": "integer", "format": "int32", "example": 1}, + "level_learned_at": {"type": "integer", "format": "int32", "examples": [ 1 ]}, "move_learn_method": { "type": "object", "required": ["name", "url"], "properties": { "name": { "type": "string", - "example": "level-up", + "examples": [ "level-up" ], }, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/move-learn-method/1/", + "examples": [ "https://pokeapi.co/api/v2/move-learn-method/1/" ], }, }, }, @@ -4469,12 +4471,12 @@ def get_pokemon_cries(self, obj): "properties": { "name": { "type": "string", - "example": "red-blue", + "examples": [ "red-blue" ], }, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/version-group/1/", + "examples": [ "https://pokeapi.co/api/v2/version-group/1/" ], }, }, }, @@ -4558,11 +4560,11 @@ def get_pokemon_moves(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "soft-sand"}, + "name": {"type": "string", "examples": [ "soft-sand" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/item/214/", + "examples": [ "https://pokeapi.co/api/v2/item/214/" ], }, }, }, @@ -4572,16 +4574,16 @@ def get_pokemon_moves(self, obj): "type": "object", "required": ["rarity", "version"], "properties": { - "rarity": {"type": "integer", "format": "int32", "example": 5}, + "rarity": {"type": "integer", "format": "int32", "examples": [ 5 ]}, "version": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "diamond"}, + "name": {"type": "string", "examples": [ "diamond" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/version/12/", + "examples": [ "https://pokeapi.co/api/v2/version/12/" ], }, }, }, @@ -4643,16 +4645,16 @@ def get_pokemon_held_items(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "sand-veil"}, + "name": {"type": "string", "examples": [ "sand-veil" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/ability/8/", + "examples": [ "https://pokeapi.co/api/v2/ability/8/" ], }, }, }, - "is_hidden": {"type": "boolean", "example": False}, - "slot": {"type": "integer", "format": "int32", "example": 1}, + "is_hidden": {"type": "boolean"}, + "slot": {"type": "integer", "format": "int32", "examples": [ 1 ]}, }, }, } @@ -4705,17 +4707,17 @@ def get_pokemon_abilities(self, obj): "properties": { "name": { "type": "string", - "example": "levitate", + "examples": [ "levitate" ], }, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/ability/26/", + "examples": [ "https://pokeapi.co/api/v2/ability/26/" ], }, }, }, - "is_hidden": {"type": "boolean", "example": False}, - "slot": {"type": "integer", "format": "int32", "example": 1}, + "is_hidden": {"type": "boolean"}, + "slot": {"type": "integer", "format": "int32", "examples": [ 1 ]}, }, }, }, @@ -4723,11 +4725,11 @@ def get_pokemon_abilities(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "generation-vi"}, + "name": {"type": "string", "examples": [ "generation-vi" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/generation/6/", + "examples": [ "https://pokeapi.co/api/v2/generation/6/" ], }, }, }, @@ -4784,16 +4786,16 @@ def get_past_pokemon_abilities(self, obj): "type": "object", "required": ["slot", "type"], "properties": { - "slot": {"type": "integer", "format": "int32", "example": 1}, + "slot": {"type": "integer", "format": "int32", "examples": [ 1 ]}, "type": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "ghost"}, + "name": {"type": "string", "examples": [ "ghost" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/type/8/", + "examples": [ "https://pokeapi.co/api/v2/type/8/" ], }, }, }, @@ -4840,11 +4842,11 @@ def get_pokemon_types(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "generation-v"}, + "name": {"type": "string", "examples": [ "generation-v" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/generation/5/", + "examples": [ "https://pokeapi.co/api/v2/generation/5/" ], }, }, }, @@ -4854,16 +4856,16 @@ def get_pokemon_types(self, obj): "type": "object", "required": ["slot", "type"], "properties": { - "slot": {"type": "integer", "format": "int32", "example": 1}, + "slot": {"type": "integer", "format": "int32", "examples": [ 1 ]}, "type": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "normal"}, + "name": {"type": "string", "examples": [ "normal" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/type/1/", + "examples": [ "https://pokeapi.co/api/v2/type/1/" ], }, }, }, @@ -4912,7 +4914,7 @@ def get_past_pokemon_types(self, obj): @extend_schema_field( field={ "type": "string", - "example": "https://pokeapi.co/api/v2/pokemon/1/encounters", + "examples": [ "https://pokeapi.co/api/v2/pokemon/1/encounters" ], } ) def get_encounters(self, obj): @@ -4947,11 +4949,11 @@ class Meta: "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "ivysaur"}, + "name": {"type": "string", "examples": [ "ivysaur" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/pokemon-species/2/", + "examples": [ "https://pokeapi.co/api/v2/pokemon-species/2/" ], }, }, }, @@ -5075,15 +5077,15 @@ class Meta: "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "en"}, + "name": {"type": "string", "examples": [ "en" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/language/9/", + "examples": [ "https://pokeapi.co/api/v2/language/9/" ], }, }, }, - "name": {"type": "string", "example": "bulbasaur"}, + "name": {"type": "string", "examples": [ "bulbasaur" ]}, }, }, } @@ -5115,16 +5117,16 @@ def get_pokemon_names(self, obj): "type": "object", "required": ["genus", "language"], "properties": { - "genus": {"type": "string", "example": "Seed Pokémon"}, + "genus": {"type": "string", "examples": [ "Seed Pokémon" ]}, "language": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "en"}, + "name": {"type": "string", "examples": [ "en" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/language/9/", + "examples": [ "https://pokeapi.co/api/v2/language/9/" ], }, }, }, @@ -5154,11 +5156,11 @@ def get_pokemon_genera(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "monster"}, + "name": {"type": "string", "examples": [ "monster" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/egg-group/1/", + "examples": [ "https://pokeapi.co/api/v2/egg-group/1/" ], }, }, }, @@ -5180,16 +5182,16 @@ def get_pokemon_egg_groups(self, obj): "type": "object", "required": ["is_default", "pokemon"], "properties": { - "is_default": {"type": "boolean", "example": True}, + "is_default": {"type": "boolean"}, "pokemon": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "bulbasaur"}, + "name": {"type": "string", "examples": [ "bulbasaur" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/pokemon/1/", + "examples": [ "https://pokeapi.co/api/v2/pokemon/1/" ], }, }, }, @@ -5227,16 +5229,16 @@ def get_pokemon_varieties(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "field"}, + "name": {"type": "string", "examples": [ "field" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/pal-park-area/2/", + "examples": [ "https://pokeapi.co/api/v2/pal-park-area/2/" ], }, }, }, - "base_score": {"type": "integer", "format": "int32", "example": 50}, - "rate": {"type": "integer", "format": "int32", "example": 30}, + "base_score": {"type": "integer", "format": "int32", "examples": [ 50 ]}, + "rate": {"type": "integer", "format": "int32", "examples": [ 30 ]}, }, }, } @@ -5304,7 +5306,7 @@ class Meta: "type": "object", "required": ["evolution_details", "evolves_to", "is_baby", "species"], "properties": { - "evolution_details": {"type": "array", "items": {}, "example": []}, + "evolution_details": {"type": "array", "items": {}, "examples": []}, "evolves_to": { "type": "array", "items": { @@ -5349,12 +5351,12 @@ class Meta: "properties": { "name": { "type": "string", - "example": 1, + "examples": [ 1 ], }, "url": { "type": "string", "format": "uri", - "example": 2, + "examples": [ 2 ], }, }, }, @@ -5365,12 +5367,12 @@ class Meta: "properties": { "name": { "type": "string", - "example": 1, + "examples": [ 1 ], }, "url": { "type": "string", "format": "uri", - "example": 2, + "examples": [ 2 ], }, }, }, @@ -5381,12 +5383,12 @@ class Meta: "properties": { "name": { "type": "string", - "example": 1, + "examples": [ 1 ], }, "url": { "type": "string", "format": "uri", - "example": 2, + "examples": [ 2 ], }, }, }, @@ -5466,32 +5468,32 @@ class Meta: }, }, }, - "is_baby": {"type": "boolean", "example": True}, + "is_baby": {"type": "boolean"}, "species": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "happiny"}, + "name": {"type": "string", "examples": [ "happiny" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/pokemon-species/440/", + "examples": [ "https://pokeapi.co/api/v2/pokemon-species/440/" ], }, }, }, }, }, }, - "is_baby": {"type": "boolean", "example": True}, + "is_baby": {"type": "boolean"}, "species": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "happiny"}, + "name": {"type": "string", "examples": [ "happiny" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/pokemon-species/440/", + "examples": [ "https://pokeapi.co/api/v2/pokemon-species/440/" ], }, }, }, @@ -5624,17 +5626,17 @@ class Meta: "max_change": { "type": "integer", "format": "int32", "maximum": -1, - "example": -1, + "examples": [ -1 ], }, "nature": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "hardy"}, + "name": {"type": "string", "examples": [ "hardy" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/nature/1/", + "examples": [ "https://pokeapi.co/api/v2/nature/1/" ], }, }, }, @@ -5650,17 +5652,17 @@ class Meta: "max_change": { "type": "integer", "format": "int32", "minimum": 1, - "example": 2, + "examples": [ 2 ], }, "nature": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "hardy"}, + "name": {"type": "string", "examples": [ "hardy" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/nature/1/", + "examples": [ "https://pokeapi.co/api/v2/nature/1/" ], }, }, }, @@ -5735,16 +5737,16 @@ class Meta: "type": "object", "required": ["entry_number", "pokemon_species"], "properties": { - "entry_number": {"type": "integer", "format": "int32", "example": 1}, + "entry_number": {"type": "integer", "format": "int32", "examples": [ 1 ]}, "pokemon_species": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "bulbasaur"}, + "name": {"type": "string", "examples": [ "bulbasaur" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/pokemon-species/1/", + "examples": [ "https://pokeapi.co/api/v2/pokemon-species/1/" ], }, }, }, @@ -5773,11 +5775,11 @@ def get_pokedex_entries(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "the-teal-mask"}, + "name": {"type": "string", "examples": [ "the-teal-mask" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/version-group/26/", + "examples": [ "https://pokeapi.co/api/v2/version-group/26/" ], }, }, }, @@ -5849,11 +5851,11 @@ class Meta: "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "kanto"}, + "name": {"type": "string", "examples": [ "kanto" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/region/1/", + "examples": [ "https://pokeapi.co/api/v2/region/1/" ], }, }, }, @@ -5880,11 +5882,11 @@ def get_version_group_regions(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "level-up"}, + "name": {"type": "string", "examples": [ "level-up" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/move-learn-method/1/", + "examples": [ "https://pokeapi.co/api/v2/move-learn-method/1/" ], }, }, }, @@ -5911,11 +5913,11 @@ def get_learn_methods(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "example": "kanto"}, + "name": {"type": "string", "examples": [ "kanto" ]}, "url": { "type": "string", "format": "uri", - "example": "https://pokeapi.co/api/v2/pokedex/2/", + "examples": [ "https://pokeapi.co/api/v2/pokedex/2/" ], }, }, }, From bf195f948c53bd48fcbd7ccaee271433d5b0e1fa Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Wed, 27 Mar 2024 23:16:38 -0500 Subject: [PATCH 48/49] chore: `make format` --- pokemon_v2/serializers.py | 695 ++++++++++++++++++++++++-------------- 1 file changed, 444 insertions(+), 251 deletions(-) diff --git a/pokemon_v2/serializers.py b/pokemon_v2/serializers.py index f2213c320..3b5df51f6 100644 --- a/pokemon_v2/serializers.py +++ b/pokemon_v2/serializers.py @@ -482,11 +482,10 @@ class Meta: field={ "type": "array", "items": { - "type": "integer", "format": "int32", + "type": "integer", + "format": "int32", }, - "examples": [ - [0, 5, 10, 15, 20, 25, 30] - ] + "examples": [[0, 5, 10, 15, 20, 25, 30]], } ) def get_values(self, obj): @@ -628,11 +627,11 @@ class Meta: "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "red-blue" ]}, + "name": {"type": "string", "examples": ["red-blue"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/version-group/1/" ], + "examples": ["https://pokeapi.co/api/v2/version-group/1/"], }, }, }, @@ -712,16 +711,18 @@ class Meta: "type": "object", "required": ["rate", "pokemon_species"], "properties": { - "rate": {"type": "integer", "format": "int32", "examples": [ 1 ]}, + "rate": {"type": "integer", "format": "int32", "examples": [1]}, "pokemon_species": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "bulbasaur" ]}, + "name": {"type": "string", "examples": ["bulbasaur"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/pokemon-species/1/" ], + "examples": [ + "https://pokeapi.co/api/v2/pokemon-species/1/" + ], }, }, }, @@ -758,11 +759,11 @@ def get_species(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "wormadam" ]}, + "name": {"type": "string", "examples": ["wormadam"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/pokemon-species/413/" ], + "examples": ["https://pokeapi.co/api/v2/pokemon-species/413/"], }, }, }, @@ -988,11 +989,13 @@ class Meta: "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "old-rod" ]}, + "name": {"type": "string", "examples": ["old-rod"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/encounter-method/2/" ], + "examples": [ + "https://pokeapi.co/api/v2/encounter-method/2/" + ], }, }, }, @@ -1002,19 +1005,25 @@ class Meta: "type": "object", "required": ["rate", "version"], "properties": { - "rate": {"type": "integer", "format": "int32", "examples": [ 5 ]}, + "rate": { + "type": "integer", + "format": "int32", + "examples": [5], + }, "version": { "type": "object", "required": ["name", "url"], "properties": { "name": { "type": "string", - "examples": [ "platinum" ], + "examples": ["platinum"], }, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/version/14/" ], + "examples": [ + "https://pokeapi.co/api/v2/version/14/" + ], }, }, }, @@ -1077,11 +1086,11 @@ def get_method_rates(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "tentacool" ]}, + "name": {"type": "string", "examples": ["tentacool"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/pokemon/72/" ], + "examples": ["https://pokeapi.co/api/v2/pokemon/72/"], }, }, }, @@ -1097,16 +1106,22 @@ def get_method_rates(self, obj): "properties": { "name": { "type": "string", - "examples": [ "diamond" ], + "examples": ["diamond"], }, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/version/12/" ], + "examples": [ + "https://pokeapi.co/api/v2/version/12/" + ], }, }, }, - "max_chance": {"type": "integer", "format": "int32", "examples": [ 60 ]}, + "max_chance": { + "type": "integer", + "format": "int32", + "examples": [60], + }, "encounter_details": { "type": "object", "required": [ @@ -1117,36 +1132,52 @@ def get_method_rates(self, obj): "method", ], "properties": { - "min_level": {"type": "integer", "format": "int32", "examples": [ 20 ]}, - "max_level": {"type": "integer", "format": "int32", "examples": [ 30 ]}, + "min_level": { + "type": "integer", + "format": "int32", + "examples": [20], + }, + "max_level": { + "type": "integer", + "format": "int32", + "examples": [30], + }, "condition_values": { "type": "object", "required": ["name", "url"], "properties": { "name": { "type": "string", - "examples": [ "slot2-sapphire" ], + "examples": ["slot2-sapphire"], }, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/encounter-condition-value/10/" ], + "examples": [ + "https://pokeapi.co/api/v2/encounter-condition-value/10/" + ], }, }, }, - "chance": {"type": "integer", "format": "int32", "examples": [ 60 ]}, + "chance": { + "type": "integer", + "format": "int32", + "examples": [60], + }, "method": { "type": "object", "required": ["name", "url"], "properties": { "name": { "type": "string", - "examples": [ "surf" ], + "examples": ["surf"], }, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/encounter-method/5/" ], + "examples": [ + "https://pokeapi.co/api/v2/encounter-method/5/" + ], }, }, }, @@ -1338,16 +1369,16 @@ class Meta: "required": ["is_hidden", "slot", "pokemon"], "properties": { "is_hidden": {"type": "boolean"}, - "slot": {"type": "integer", "format": "int32", "examples": [ 3 ]}, + "slot": {"type": "integer", "format": "int32", "examples": [3]}, "pokemon": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "gloom" ]}, + "name": {"type": "string", "examples": ["gloom"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/pokemon/44/" ], + "examples": ["https://pokeapi.co/api/v2/pokemon/44/"], }, }, }, @@ -1416,19 +1447,25 @@ class Meta: "type": "object", "required": ["change", "move"], "properties": { - "change": {"type": "integer", "format": "int32", "examples": [ -1 ]}, + "change": { + "type": "integer", + "format": "int32", + "examples": [-1], + }, "move": { "type": "object", "required": ["name", "url"], "properties": { "name": { "type": "string", - "examples": [ "swords-dance" ], + "examples": ["swords-dance"], }, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/move/14/" ], + "examples": [ + "https://pokeapi.co/api/v2/move/14/" + ], }, }, }, @@ -1441,16 +1478,22 @@ class Meta: "type": "object", "required": ["change", "move"], "properties": { - "change": {"type": "integer", "format": "int32", "examples": [ 5 ]}, + "change": { + "type": "integer", + "format": "int32", + "examples": [5], + }, "move": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "growl" ]}, + "name": {"type": "string", "examples": ["growl"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/move/45/" ], + "examples": [ + "https://pokeapi.co/api/v2/move/45/" + ], }, }, }, @@ -1487,11 +1530,11 @@ def get_moves_that_affect(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "lonely" ]}, + "name": {"type": "string", "examples": ["lonely"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/nature/6/" ], + "examples": ["https://pokeapi.co/api/v2/nature/6/"], }, }, }, @@ -1502,11 +1545,11 @@ def get_moves_that_affect(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "bold" ]}, + "name": {"type": "string", "examples": ["bold"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/nature/2/" ], + "examples": ["https://pokeapi.co/api/v2/nature/2/"], }, }, }, @@ -1615,11 +1658,11 @@ class Meta: "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "master-ball" ]}, + "name": {"type": "string", "examples": ["master-ball"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/item/1/" ], + "examples": ["https://pokeapi.co/api/v2/item/1/"], }, }, }, @@ -1751,17 +1794,19 @@ class Meta: "machine": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/machine/1/" ], + "examples": ["https://pokeapi.co/api/v2/machine/1/"], }, "version_group": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "sword-shield" ]}, + "name": {"type": "string", "examples": ["sword-shield"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/version-group/20/" ], + "examples": [ + "https://pokeapi.co/api/v2/version-group/20/" + ], }, }, }, @@ -1797,7 +1842,9 @@ def get_item_machines(self, obj): "default": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/media/sprites/items/master-ball.png" ], + "examples": [ + "https://pokeapi.co/media/sprites/items/master-ball.png" + ], } }, } @@ -1813,11 +1860,11 @@ def get_item_sprites(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "countable" ]}, + "name": {"type": "string", "examples": ["countable"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/item-attribute/1/" ], + "examples": ["https://pokeapi.co/api/v2/item-attribute/1/"], }, }, }, @@ -1851,11 +1898,11 @@ def get_item_attributes(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "farfetchd" ]}, + "name": {"type": "string", "examples": ["farfetchd"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/pokemon/83/" ], + "examples": ["https://pokeapi.co/api/v2/pokemon/83/"], }, }, }, @@ -1865,16 +1912,25 @@ def get_item_attributes(self, obj): "type": "object", "required": ["rarity", "version"], "properties": { - "rarity": {"type": "integer", "format": "int32", "examples": [ 5 ]}, + "rarity": { + "type": "integer", + "format": "int32", + "examples": [5], + }, "version": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "ruby" ]}, + "name": { + "type": "string", + "examples": ["ruby"], + }, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/version/7/" ], + "examples": [ + "https://pokeapi.co/api/v2/version/7/" + ], }, }, }, @@ -1925,7 +1981,7 @@ def get_held_by_pokemon(self, obj): "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/evolution-chain/51/" ], + "examples": ["https://pokeapi.co/api/v2/evolution-chain/51/"], } }, } @@ -2001,16 +2057,22 @@ class Meta: "type": "object", "required": ["max_change", "pokeathlon_stat"], "properties": { - "max_change": {"type": "integer", "format": "int32", "examples": [ 1 ]}, + "max_change": { + "type": "integer", + "format": "int32", + "examples": [1], + }, "pokeathlon_stat": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "power" ]}, + "name": {"type": "string", "examples": ["power"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/pokeathlon-stat/2/" ], + "examples": [ + "https://pokeapi.co/api/v2/pokeathlon-stat/2/" + ], }, }, }, @@ -2080,7 +2142,7 @@ class Meta: "type": "object", "required": ["potency", "berry"], "properties": { - "potency": {"type": "integer", "examples": [ 10 ]}, + "potency": {"type": "integer", "examples": [10]}, "berry": { "type": "object", "require": ["name", "url"], @@ -2088,13 +2150,13 @@ class Meta: "name": { "type": "string", "description": "The name of the berry", - "examples": [ "rowap" ], + "examples": ["rowap"], }, "url": { "type": "string", "format": "uri", "description": "The URL to get more information about the berry", - "examples": [ "https://pokeapi.co/api/v2/berry/64/" ], + "examples": ["https://pokeapi.co/api/v2/berry/64/"], }, }, }, @@ -2146,7 +2208,7 @@ class Meta: "type": "object", "required": ["potency", "flavor"], "properties": { - "potency": {"type": "integer", "examples": [ 10 ]}, + "potency": {"type": "integer", "examples": [10]}, "flavor": { "type": "object", "require": ["name", "url"], @@ -2154,13 +2216,15 @@ class Meta: "name": { "type": "string", "description": "The name of the flavor", - "examples": [ "spicy" ], + "examples": ["spicy"], }, "url": { "type": "string", "format": "uri", "description": "The URL to get more information about the flavor", - "examples": [ "https://pokeapi.co/api/v2/berry-flavor/1/" ], + "examples": [ + "https://pokeapi.co/api/v2/berry-flavor/1/" + ], }, }, }, @@ -2220,13 +2284,13 @@ class Meta: "name": { "type": "string", "description": "Pokemon species name.", - "examples": [ "bulbasaur" ], + "examples": ["bulbasaur"], }, "url": { "type": "string", "format": "uri", "description": "The URL to get more information about the species", - "examples": [ "https://pokeapi.co/api/v2/pokemon-species/1/" ], + "examples": ["https://pokeapi.co/api/v2/pokemon-species/1/"], }, }, }, @@ -2344,11 +2408,11 @@ def add_type_entry(self, relations, type, damage_factor, direction="_damage_to") "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "flying" ]}, + "name": {"type": "string", "examples": ["flying"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/type/3/" ], + "examples": ["https://pokeapi.co/api/v2/type/3/"], }, }, }, @@ -2359,11 +2423,11 @@ def add_type_entry(self, relations, type, damage_factor, direction="_damage_to") "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "bug" ]}, + "name": {"type": "string", "examples": ["bug"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/type/7/" ], + "examples": ["https://pokeapi.co/api/v2/type/7/"], }, }, }, @@ -2374,11 +2438,11 @@ def add_type_entry(self, relations, type, damage_factor, direction="_damage_to") "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "poison" ]}, + "name": {"type": "string", "examples": ["poison"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/type/4/" ], + "examples": ["https://pokeapi.co/api/v2/type/4/"], }, }, }, @@ -2389,11 +2453,11 @@ def add_type_entry(self, relations, type, damage_factor, direction="_damage_to") "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "electric" ]}, + "name": {"type": "string", "examples": ["electric"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/type/13/" ], + "examples": ["https://pokeapi.co/api/v2/type/13/"], }, }, }, @@ -2404,11 +2468,11 @@ def add_type_entry(self, relations, type, damage_factor, direction="_damage_to") "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "poison" ]}, + "name": {"type": "string", "examples": ["poison"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/type/4/" ], + "examples": ["https://pokeapi.co/api/v2/type/4/"], }, }, }, @@ -2419,11 +2483,11 @@ def add_type_entry(self, relations, type, damage_factor, direction="_damage_to") "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "water" ]}, + "name": {"type": "string", "examples": ["water"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/type/11/" ], + "examples": ["https://pokeapi.co/api/v2/type/11/"], }, }, }, @@ -2506,11 +2570,11 @@ def remove_type_entry(self, relations, type, direction="_damage_to"): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "generation-v" ]}, + "name": {"type": "string", "examples": ["generation-v"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/generation/5/" ], + "examples": ["https://pokeapi.co/api/v2/generation/5/"], }, }, }, @@ -2531,11 +2595,16 @@ def remove_type_entry(self, relations, type, direction="_damage_to"): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "flying" ]}, + "name": { + "type": "string", + "examples": ["flying"], + }, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/type/3/" ], + "examples": [ + "https://pokeapi.co/api/v2/type/3/" + ], }, }, }, @@ -2546,11 +2615,13 @@ def remove_type_entry(self, relations, type, direction="_damage_to"): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "bug" ]}, + "name": {"type": "string", "examples": ["bug"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/type/7/" ], + "examples": [ + "https://pokeapi.co/api/v2/type/7/" + ], }, }, }, @@ -2561,11 +2632,16 @@ def remove_type_entry(self, relations, type, direction="_damage_to"): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "poison" ]}, + "name": { + "type": "string", + "examples": ["poison"], + }, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/type/4/" ], + "examples": [ + "https://pokeapi.co/api/v2/type/4/" + ], }, }, }, @@ -2578,12 +2654,14 @@ def remove_type_entry(self, relations, type, direction="_damage_to"): "properties": { "name": { "type": "string", - "examples": [ "electric" ], + "examples": ["electric"], }, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/type/13/" ], + "examples": [ + "https://pokeapi.co/api/v2/type/13/" + ], }, }, }, @@ -2594,11 +2672,16 @@ def remove_type_entry(self, relations, type, direction="_damage_to"): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "poison" ]}, + "name": { + "type": "string", + "examples": ["poison"], + }, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/type/4/" ], + "examples": [ + "https://pokeapi.co/api/v2/type/4/" + ], }, }, }, @@ -2609,11 +2692,16 @@ def remove_type_entry(self, relations, type, direction="_damage_to"): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "water" ]}, + "name": { + "type": "string", + "examples": ["water"], + }, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/type/11/" ], + "examples": [ + "https://pokeapi.co/api/v2/type/11/" + ], }, }, }, @@ -2725,7 +2813,7 @@ def type_is_present(self, type, current_gen): "type": "object", "required": ["potency", "flavor"], "properties": { - "slot": {"type": "integer", "examples": [ 1 ]}, + "slot": {"type": "integer", "examples": [1]}, "pokemon": { "type": "object", "require": ["name", "url"], @@ -2733,13 +2821,13 @@ def type_is_present(self, type, current_gen): "name": { "type": "string", "description": "The name of the pokemon", - "examples": [ "sandshrew" ], + "examples": ["sandshrew"], }, "url": { "type": "string", "format": "uri", "description": "The URL to get more information about the pokemon", - "examples": [ "https://pokeapi.co/api/v2/pokemon/27/" ], + "examples": ["https://pokeapi.co/api/v2/pokemon/27/"], }, }, }, @@ -2860,11 +2948,11 @@ class Meta: "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "thunder-punch" ]}, + "name": {"type": "string", "examples": ["thunder-punch"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/move/9/" ], + "examples": ["https://pokeapi.co/api/v2/move/9/"], }, }, }, @@ -2907,11 +2995,11 @@ class Meta: "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "sing" ]}, + "name": {"type": "string", "examples": ["sing"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/move/47/" ], + "examples": ["https://pokeapi.co/api/v2/move/47/"], }, }, }, @@ -3020,21 +3108,25 @@ class Meta: "properties": { "effect": { "type": "string", - "examples": [ "Inflicts [regular damage]{mechanic:regular-damage}." ], + "examples": [ + "Inflicts [regular damage]{mechanic:regular-damage}." + ], }, "short_effect": { "type": "string", - "examples": [ "Inflicts regular damage with no additional effect." ], + "examples": [ + "Inflicts regular damage with no additional effect." + ], }, "language": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "en" ]}, + "name": {"type": "string", "examples": ["en"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/language/9/" ], + "examples": ["https://pokeapi.co/api/v2/language/9/"], }, }, }, @@ -3146,11 +3238,11 @@ class Meta: "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "clefairy" ]}, + "name": {"type": "string", "examples": ["clefairy"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/pokemon/35/" ], + "examples": ["https://pokeapi.co/api/v2/pokemon/35/"], }, }, }, @@ -3187,7 +3279,7 @@ def get_learned_by_pokemon(self, obj): "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/machine/1/" ], + "examples": ["https://pokeapi.co/api/v2/machine/1/"], } }, }, @@ -3195,11 +3287,13 @@ def get_learned_by_pokemon(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "sword-shield" ]}, + "name": {"type": "string", "examples": ["sword-shield"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/version-group/1/" ], + "examples": [ + "https://pokeapi.co/api/v2/version-group/1/" + ], }, }, }, @@ -3243,11 +3337,16 @@ def get_move_machines(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "fire-punch" ]}, + "name": { + "type": "string", + "examples": ["fire-punch"], + }, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/move/7/" ], + "examples": [ + "https://pokeapi.co/api/v2/move/7/" + ], }, }, }, @@ -3259,11 +3358,16 @@ def get_move_machines(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "ice-punch" ]}, + "name": { + "type": "string", + "examples": ["ice-punch"], + }, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/move/8/" ], + "examples": [ + "https://pokeapi.co/api/v2/move/8/" + ], }, }, }, @@ -3283,12 +3387,14 @@ def get_move_machines(self, obj): "properties": { "name": { "type": "string", - "examples": [ "night-slash" ], + "examples": ["night-slash"], }, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/move/400/" ], + "examples": [ + "https://pokeapi.co/api/v2/move/400/" + ], }, }, }, @@ -3302,12 +3408,14 @@ def get_move_machines(self, obj): "properties": { "name": { "type": "string", - "examples": [ "focus-energy" ], + "examples": ["focus-energy"], }, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/move/116/" ], + "examples": [ + "https://pokeapi.co/api/v2/move/116/" + ], }, }, }, @@ -3383,21 +3491,25 @@ def get_combos(self, obj): "properties": { "effect": { "type": "string", - "examples": [ "Inflicts [regular damage]{mechanic:regular-damage}." ], + "examples": [ + "Inflicts [regular damage]{mechanic:regular-damage}." + ], }, "short_effect": { "type": "string", - "examples": [ "Inflicts regular damage with no additional effect." ], + "examples": [ + "Inflicts regular damage with no additional effect." + ], }, "language": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "en" ]}, + "name": {"type": "string", "examples": ["en"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/language/9/" ], + "examples": ["https://pokeapi.co/api/v2/language/9/"], }, }, }, @@ -3434,17 +3546,21 @@ def get_effect_text(self, obj): "properties": { "effect": { "type": "string", - "examples": [ "Hits Pokémon under the effects of dig and fly." ], + "examples": [ + "Hits Pokémon under the effects of dig and fly." + ], }, "language": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "en" ]}, + "name": {"type": "string", "examples": ["en"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/language/9/" ], + "examples": [ + "https://pokeapi.co/api/v2/language/9/" + ], }, }, }, @@ -3455,11 +3571,13 @@ def get_effect_text(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "gold-silver" ]}, + "name": {"type": "string", "examples": ["gold-silver"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/version-group/3/" ], + "examples": [ + "https://pokeapi.co/api/v2/version-group/3/" + ], }, }, }, @@ -3482,16 +3600,16 @@ def get_effect_change_text(self, obj): "type": "object", "required": ["change", "stat"], "properties": { - "change": {"type": "integer", "format": "int32", "examples": [ 2 ]}, + "change": {"type": "integer", "format": "int32", "examples": [2]}, "stat": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "attack" ]}, + "name": {"type": "string", "examples": ["attack"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/stat/1/" ], + "examples": ["https://pokeapi.co/api/v2/stat/1/"], }, }, }, @@ -3550,20 +3668,26 @@ class Meta: "type": "object", "required": ["base_score", "pokemon-species", "rate"], "properties": { - "base_score": {"type": "integer", "format": "int32", "examples": [ 50 ]}, + "base_score": { + "type": "integer", + "format": "int32", + "examples": [50], + }, "pokemon-species": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "bulbasaur" ]}, + "name": {"type": "string", "examples": ["bulbasaur"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/pokemon-species/1/" ], + "examples": [ + "https://pokeapi.co/api/v2/pokemon-species/1/" + ], }, }, }, - "rate": {"type": "integer", "format": "int32", "examples": [ 30 ]}, + "rate": {"type": "integer", "format": "int32", "examples": [30]}, }, }, } @@ -3663,15 +3787,15 @@ class Meta: "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "en" ]}, + "name": {"type": "string", "examples": ["en"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/language/9/" ], + "examples": ["https://pokeapi.co/api/v2/language/9/"], }, }, }, - "name": {"type": "string", "examples": [ "Plant Cloak" ]}, + "name": {"type": "string", "examples": ["Plant Cloak"]}, }, }, } @@ -3702,15 +3826,15 @@ def get_pokemon_form_names(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "en" ]}, + "name": {"type": "string", "examples": ["en"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/language/9/" ], + "examples": ["https://pokeapi.co/api/v2/language/9/"], }, }, }, - "name": {"type": "string", "examples": [ "Plant Cloak" ]}, + "name": {"type": "string", "examples": ["Plant Cloak"]}, }, }, } @@ -3738,25 +3862,31 @@ def get_pokemon_form_pokemon_names(self, obj): "default": { "type": "string", "format": "uri", - "examples": [ "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/412.png" ], + "examples": [ + "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/412.png" + ], } }, "additionalProperties": { # Stoplight Elements doesn't render this well "type": "string", "format": "uri", "nullable": True, - "examples": [ "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/412.png" ], + "examples": [ + "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/412.png" + ], }, - "examples": [ { - "back_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/412.png", - "back_female": None, - "back_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/412.png", - "back_shiny_female": None, - "front_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/412.png", - "front_female": None, - "front_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/shiny/412.png", - "front_shiny_female": None, - } ], + "examples": [ + { + "back_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/412.png", + "back_female": None, + "back_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/412.png", + "back_shiny_female": None, + "front_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/412.png", + "front_female": None, + "front_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/shiny/412.png", + "front_shiny_female": None, + } + ], } ) def get_pokemon_form_sprites(self, obj): @@ -3770,16 +3900,16 @@ def get_pokemon_form_sprites(self, obj): "type": "object", "required": ["slot", "type"], "properties": { - "slot": {"type": "integer", "format": "int32", "examples": [ 1 ]}, + "slot": {"type": "integer", "format": "int32", "examples": [1]}, "type": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "bug" ]}, + "name": {"type": "string", "examples": ["bug"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/type/7/" ], + "examples": ["https://pokeapi.co/api/v2/type/7/"], }, }, }, @@ -3883,11 +4013,11 @@ class Meta: "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "red-blue" ]}, + "name": {"type": "string", "examples": ["red-blue"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/version-group/1/" ], + "examples": ["https://pokeapi.co/api/v2/version-group/1/"], }, }, }, @@ -3947,9 +4077,9 @@ class Meta: "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/language/9/" ], + "examples": ["https://pokeapi.co/api/v2/language/9/"], }, - "name": {"type": "string", "examples": [ "Ball" ]}, + "name": {"type": "string", "examples": ["Ball"]}, }, }, } @@ -3989,16 +4119,16 @@ def get_shape_names(self, obj): "type": "object", "required": ["awesome_name", "language"], "properties": { - "awesome_name": {"type": "string", "examples": [ "Pomaceous" ]}, + "awesome_name": {"type": "string", "examples": ["Pomaceous"]}, "language": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "en" ]}, + "name": {"type": "string", "examples": ["en"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/language/9/" ], + "examples": ["https://pokeapi.co/api/v2/language/9/"], }, }, }, @@ -4113,18 +4243,22 @@ class Meta: "type": "string", "format": "uri", "nullable": True, - "examples": [ "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/1.png" ], + "examples": [ + "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/1.png" + ], }, - "examples": [ { - "back_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/1.png", - "back_female": None, - "back_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/1.png", - "back_shiny_female": None, - "front_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/1.png", - "front_female": None, - "front_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/shiny/1.png", - "front_shiny_female": None, - } ], + "examples": [ + { + "back_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/1.png", + "back_female": None, + "back_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/1.png", + "back_shiny_female": None, + "front_default": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/1.png", + "front_female": None, + "front_shiny": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/shiny/1.png", + "front_shiny_female": None, + } + ], } ) def get_pokemon_sprites(self, obj): @@ -4139,12 +4273,16 @@ def get_pokemon_sprites(self, obj): "latest": { "type": "string", "format": "uri", - "examples": [ "https://raw.githubusercontent.com/PokeAPI/cries/main/cries/pokemon/latest/50.ogg" ], + "examples": [ + "https://raw.githubusercontent.com/PokeAPI/cries/main/cries/pokemon/latest/50.ogg" + ], }, "legacy": { "type": "string", "format": "uri", - "examples": [ "https://raw.githubusercontent.com/PokeAPI/cries/main/cries/pokemon/legacy/50.ogg" ], + "examples": [ + "https://raw.githubusercontent.com/PokeAPI/cries/main/cries/pokemon/legacy/50.ogg" + ], }, }, } @@ -4431,11 +4569,11 @@ def get_pokemon_cries(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "scratch" ]}, + "name": {"type": "string", "examples": ["scratch"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/move/10/" ], + "examples": ["https://pokeapi.co/api/v2/move/10/"], }, }, }, @@ -4449,19 +4587,25 @@ def get_pokemon_cries(self, obj): "version_group", ], "properties": { - "level_learned_at": {"type": "integer", "format": "int32", "examples": [ 1 ]}, + "level_learned_at": { + "type": "integer", + "format": "int32", + "examples": [1], + }, "move_learn_method": { "type": "object", "required": ["name", "url"], "properties": { "name": { "type": "string", - "examples": [ "level-up" ], + "examples": ["level-up"], }, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/move-learn-method/1/" ], + "examples": [ + "https://pokeapi.co/api/v2/move-learn-method/1/" + ], }, }, }, @@ -4471,12 +4615,14 @@ def get_pokemon_cries(self, obj): "properties": { "name": { "type": "string", - "examples": [ "red-blue" ], + "examples": ["red-blue"], }, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/version-group/1/" ], + "examples": [ + "https://pokeapi.co/api/v2/version-group/1/" + ], }, }, }, @@ -4560,11 +4706,11 @@ def get_pokemon_moves(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "soft-sand" ]}, + "name": {"type": "string", "examples": ["soft-sand"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/item/214/" ], + "examples": ["https://pokeapi.co/api/v2/item/214/"], }, }, }, @@ -4574,16 +4720,22 @@ def get_pokemon_moves(self, obj): "type": "object", "required": ["rarity", "version"], "properties": { - "rarity": {"type": "integer", "format": "int32", "examples": [ 5 ]}, + "rarity": { + "type": "integer", + "format": "int32", + "examples": [5], + }, "version": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "diamond" ]}, + "name": {"type": "string", "examples": ["diamond"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/version/12/" ], + "examples": [ + "https://pokeapi.co/api/v2/version/12/" + ], }, }, }, @@ -4645,16 +4797,16 @@ def get_pokemon_held_items(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "sand-veil" ]}, + "name": {"type": "string", "examples": ["sand-veil"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/ability/8/" ], + "examples": ["https://pokeapi.co/api/v2/ability/8/"], }, }, }, "is_hidden": {"type": "boolean"}, - "slot": {"type": "integer", "format": "int32", "examples": [ 1 ]}, + "slot": {"type": "integer", "format": "int32", "examples": [1]}, }, }, } @@ -4707,17 +4859,23 @@ def get_pokemon_abilities(self, obj): "properties": { "name": { "type": "string", - "examples": [ "levitate" ], + "examples": ["levitate"], }, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/ability/26/" ], + "examples": [ + "https://pokeapi.co/api/v2/ability/26/" + ], }, }, }, "is_hidden": {"type": "boolean"}, - "slot": {"type": "integer", "format": "int32", "examples": [ 1 ]}, + "slot": { + "type": "integer", + "format": "int32", + "examples": [1], + }, }, }, }, @@ -4725,11 +4883,11 @@ def get_pokemon_abilities(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "generation-vi" ]}, + "name": {"type": "string", "examples": ["generation-vi"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/generation/6/" ], + "examples": ["https://pokeapi.co/api/v2/generation/6/"], }, }, }, @@ -4786,16 +4944,16 @@ def get_past_pokemon_abilities(self, obj): "type": "object", "required": ["slot", "type"], "properties": { - "slot": {"type": "integer", "format": "int32", "examples": [ 1 ]}, + "slot": {"type": "integer", "format": "int32", "examples": [1]}, "type": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "ghost" ]}, + "name": {"type": "string", "examples": ["ghost"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/type/8/" ], + "examples": ["https://pokeapi.co/api/v2/type/8/"], }, }, }, @@ -4842,11 +5000,11 @@ def get_pokemon_types(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "generation-v" ]}, + "name": {"type": "string", "examples": ["generation-v"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/generation/5/" ], + "examples": ["https://pokeapi.co/api/v2/generation/5/"], }, }, }, @@ -4856,16 +5014,25 @@ def get_pokemon_types(self, obj): "type": "object", "required": ["slot", "type"], "properties": { - "slot": {"type": "integer", "format": "int32", "examples": [ 1 ]}, + "slot": { + "type": "integer", + "format": "int32", + "examples": [1], + }, "type": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "normal" ]}, + "name": { + "type": "string", + "examples": ["normal"], + }, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/type/1/" ], + "examples": [ + "https://pokeapi.co/api/v2/type/1/" + ], }, }, }, @@ -4914,7 +5081,7 @@ def get_past_pokemon_types(self, obj): @extend_schema_field( field={ "type": "string", - "examples": [ "https://pokeapi.co/api/v2/pokemon/1/encounters" ], + "examples": ["https://pokeapi.co/api/v2/pokemon/1/encounters"], } ) def get_encounters(self, obj): @@ -4949,11 +5116,11 @@ class Meta: "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "ivysaur" ]}, + "name": {"type": "string", "examples": ["ivysaur"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/pokemon-species/2/" ], + "examples": ["https://pokeapi.co/api/v2/pokemon-species/2/"], }, }, }, @@ -5077,15 +5244,15 @@ class Meta: "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "en" ]}, + "name": {"type": "string", "examples": ["en"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/language/9/" ], + "examples": ["https://pokeapi.co/api/v2/language/9/"], }, }, }, - "name": {"type": "string", "examples": [ "bulbasaur" ]}, + "name": {"type": "string", "examples": ["bulbasaur"]}, }, }, } @@ -5117,16 +5284,16 @@ def get_pokemon_names(self, obj): "type": "object", "required": ["genus", "language"], "properties": { - "genus": {"type": "string", "examples": [ "Seed Pokémon" ]}, + "genus": {"type": "string", "examples": ["Seed Pokémon"]}, "language": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "en" ]}, + "name": {"type": "string", "examples": ["en"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/language/9/" ], + "examples": ["https://pokeapi.co/api/v2/language/9/"], }, }, }, @@ -5156,11 +5323,11 @@ def get_pokemon_genera(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "monster" ]}, + "name": {"type": "string", "examples": ["monster"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/egg-group/1/" ], + "examples": ["https://pokeapi.co/api/v2/egg-group/1/"], }, }, }, @@ -5187,11 +5354,11 @@ def get_pokemon_egg_groups(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "bulbasaur" ]}, + "name": {"type": "string", "examples": ["bulbasaur"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/pokemon/1/" ], + "examples": ["https://pokeapi.co/api/v2/pokemon/1/"], }, }, }, @@ -5229,16 +5396,22 @@ def get_pokemon_varieties(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "field" ]}, + "name": {"type": "string", "examples": ["field"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/pal-park-area/2/" ], + "examples": [ + "https://pokeapi.co/api/v2/pal-park-area/2/" + ], }, }, }, - "base_score": {"type": "integer", "format": "int32", "examples": [ 50 ]}, - "rate": {"type": "integer", "format": "int32", "examples": [ 30 ]}, + "base_score": { + "type": "integer", + "format": "int32", + "examples": [50], + }, + "rate": {"type": "integer", "format": "int32", "examples": [30]}, }, }, } @@ -5351,12 +5524,12 @@ class Meta: "properties": { "name": { "type": "string", - "examples": [ 1 ], + "examples": [1], }, "url": { "type": "string", "format": "uri", - "examples": [ 2 ], + "examples": [2], }, }, }, @@ -5367,12 +5540,12 @@ class Meta: "properties": { "name": { "type": "string", - "examples": [ 1 ], + "examples": [1], }, "url": { "type": "string", "format": "uri", - "examples": [ 2 ], + "examples": [2], }, }, }, @@ -5383,12 +5556,12 @@ class Meta: "properties": { "name": { "type": "string", - "examples": [ 1 ], + "examples": [1], }, "url": { "type": "string", "format": "uri", - "examples": [ 2 ], + "examples": [2], }, }, }, @@ -5415,19 +5588,23 @@ class Meta: }, }, "min_affection": { - "type": "integer", "format": "int32", + "type": "integer", + "format": "int32", "nullable": True, }, "min_beauty": { - "type": "integer", "format": "int32", + "type": "integer", + "format": "int32", "nullable": True, }, "min_happiness": { - "type": "integer", "format": "int32", + "type": "integer", + "format": "int32", "nullable": True, }, "min_level": { - "type": "integer", "format": "int32", + "type": "integer", + "format": "int32", "nullable": True, }, "needs_overworld_rain": { @@ -5473,11 +5650,13 @@ class Meta: "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "happiny" ]}, + "name": {"type": "string", "examples": ["happiny"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/pokemon-species/440/" ], + "examples": [ + "https://pokeapi.co/api/v2/pokemon-species/440/" + ], }, }, }, @@ -5489,11 +5668,13 @@ class Meta: "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "happiny" ]}, + "name": {"type": "string", "examples": ["happiny"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/pokemon-species/440/" ], + "examples": [ + "https://pokeapi.co/api/v2/pokemon-species/440/" + ], }, }, }, @@ -5624,19 +5805,22 @@ class Meta: "required": ["max_change", "nature"], "properties": { "max_change": { - "type": "integer", "format": "int32", + "type": "integer", + "format": "int32", "maximum": -1, - "examples": [ -1 ], + "examples": [-1], }, "nature": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "hardy" ]}, + "name": {"type": "string", "examples": ["hardy"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/nature/1/" ], + "examples": [ + "https://pokeapi.co/api/v2/nature/1/" + ], }, }, }, @@ -5650,19 +5834,22 @@ class Meta: "required": ["max_change", "nature"], "properties": { "max_change": { - "type": "integer", "format": "int32", + "type": "integer", + "format": "int32", "minimum": 1, - "examples": [ 2 ], + "examples": [2], }, "nature": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "hardy" ]}, + "name": {"type": "string", "examples": ["hardy"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/nature/1/" ], + "examples": [ + "https://pokeapi.co/api/v2/nature/1/" + ], }, }, }, @@ -5737,16 +5924,22 @@ class Meta: "type": "object", "required": ["entry_number", "pokemon_species"], "properties": { - "entry_number": {"type": "integer", "format": "int32", "examples": [ 1 ]}, + "entry_number": { + "type": "integer", + "format": "int32", + "examples": [1], + }, "pokemon_species": { "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "bulbasaur" ]}, + "name": {"type": "string", "examples": ["bulbasaur"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/pokemon-species/1/" ], + "examples": [ + "https://pokeapi.co/api/v2/pokemon-species/1/" + ], }, }, }, @@ -5775,11 +5968,11 @@ def get_pokedex_entries(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "the-teal-mask" ]}, + "name": {"type": "string", "examples": ["the-teal-mask"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/version-group/26/" ], + "examples": ["https://pokeapi.co/api/v2/version-group/26/"], }, }, }, @@ -5851,11 +6044,11 @@ class Meta: "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "kanto" ]}, + "name": {"type": "string", "examples": ["kanto"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/region/1/" ], + "examples": ["https://pokeapi.co/api/v2/region/1/"], }, }, }, @@ -5882,11 +6075,11 @@ def get_version_group_regions(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "level-up" ]}, + "name": {"type": "string", "examples": ["level-up"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/move-learn-method/1/" ], + "examples": ["https://pokeapi.co/api/v2/move-learn-method/1/"], }, }, }, @@ -5913,11 +6106,11 @@ def get_learn_methods(self, obj): "type": "object", "required": ["name", "url"], "properties": { - "name": {"type": "string", "examples": [ "kanto" ]}, + "name": {"type": "string", "examples": ["kanto"]}, "url": { "type": "string", "format": "uri", - "examples": [ "https://pokeapi.co/api/v2/pokedex/2/" ], + "examples": ["https://pokeapi.co/api/v2/pokedex/2/"], }, }, }, From 7ea210fcfb6b9a3908cf94a50cff70c524cfa230 Mon Sep 17 00:00:00 2001 From: indyandie <1058837+Indyandie@users.noreply.github.com> Date: Fri, 5 Apr 2024 00:24:59 -0500 Subject: [PATCH 49/49] bump: drf-spectacular `0.27.2` --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 7c5ef92eb..383b8bbd5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,4 +11,4 @@ mimeparse==0.1.3 psycopg2-binary==2.9.9 python-dateutil==2.8.2 python-mimeparse==1.6.0 -drf-spectacular==0.27.1 +drf-spectacular==0.27.2