mirror of
https://github.com/PokeAPI/pokeapi
synced 2024-11-21 19:03:08 +00:00
fix: add move_learn_method
schema_field definitions
This commit is contained in:
parent
3bb60381f0
commit
fe9c1fa98d
2 changed files with 36 additions and 3 deletions
16
openapi.yml
16
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
|
||||
|
|
|
@ -3952,7 +3952,28 @@ class MoveLearnMethodDetailSerializer(serializers.ModelSerializer):
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue