mirror of
https://github.com/PokeAPI/pokeapi
synced 2024-11-10 06:04:18 +00:00
fix: add pal-park-area
schema_field definitions
This commit is contained in:
parent
e7ea8b2e8c
commit
ef97bc6a45
2 changed files with 81 additions and 5 deletions
54
openapi.yml
54
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
|
||||
|
|
|
@ -3613,7 +3613,37 @@ class PalParkAreaDetailSerializer(serializers.ModelSerializer):
|
|||
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(
|
||||
|
|
Loading…
Reference in a new issue