Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 60 additions & 1 deletion openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4077,6 +4077,7 @@ components:
- min_level
- min_move_count
- min_steps
- near_special_rock
- needs_multiplayer
- needs_overworld_rain
- party_species
Expand Down Expand Up @@ -4184,6 +4185,9 @@ components:
type: integer
format: int32
nullable: true
near_special_rock:
type: boolean
nullable: true
needs_multiplayer:
type: boolean
nullable: true
Expand Down Expand Up @@ -8152,7 +8156,62 @@ components:
$ref: '#/components/schemas/PokemonStat'
readOnly: true
past_stats:
type: string
type: array
items:
type: object
required:
- generation
- stats
properties:
generation:
type: object
required:
- name
- url
properties:
name:
type: string
examples:
- generation-vi
url:
type: string
format: uri
examples:
- https://pokeapi.co/api/v2/generation/6/
stats:
type: array
items:
type: object
required:
- base_stat
- effort
- stat
properties:
base_stat:
type: integer
format: int32
examples:
- 45
effort:
type: integer
format: int32
examples:
- 0
stat:
type: object
required:
- name
- url
properties:
name:
type: string
examples:
- speed
url:
type: string
format: uri
examples:
- https://pokeapi.co/api/v2/stat/6/
readOnly: true
types:
type: array
Expand Down
59 changes: 59 additions & 0 deletions pokemon_v2/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5092,6 +5092,65 @@ def get_past_pokemon_abilities(self, obj):

return final_data

@extend_schema_field(
field={
"type": "array",
"items": {
"type": "object",
"required": ["generation", "stats"],
"properties": {
"generation": {
"type": "object",
"required": ["name", "url"],
"properties": {
"name": {"type": "string", "examples": ["generation-vi"]},
"url": {
"type": "string",
"format": "uri",
"examples": ["https://pokeapi.co/api/v2/generation/6/"],
},
},
},
"stats": {
"type": "array",
"items": {
"type": "object",
"required": ["base_stat", "effort", "stat"],
"properties": {
"base_stat": {
"type": "integer",
"format": "int32",
"examples": [45],
},
"effort": {
"type": "integer",
"format": "int32",
"examples": [0],
},
"stat": {
"type": "object",
"required": ["name", "url"],
"properties": {
"name": {
"type": "string",
"examples": ["speed"],
},
"url": {
"type": "string",
"format": "uri",
"examples": [
"https://pokeapi.co/api/v2/stat/6/"
],
},
},
},
},
},
},
},
},
}
)
def get_past_pokemon_stats(self, obj):
pokemon_past_stat_objects = PokemonStatPast.objects.filter(pokemon=obj)
pokemon_past_stats = PokemonStatPastSerializer(
Expand Down
Loading