mirror of
https://github.com/PokeAPI/pokeapi
synced 2024-11-22 03:13:06 +00:00
fix: add nature
schema_field definitions
This commit is contained in:
parent
3c9d27bf46
commit
928507938a
2 changed files with 50 additions and 3 deletions
25
openapi.yml
25
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
|
||||
|
|
|
@ -2025,7 +2025,33 @@ class NatureDetailSerializer(serializers.ModelSerializer):
|
|||
"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(
|
||||
|
|
Loading…
Reference in a new issue