Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix (API V2): Added missing Serializers to CreatureSerializer #603

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
4 changes: 4 additions & 0 deletions api_v2/serializers/creature.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

from .abstracts import GameContentSerializer
from .document import DocumentSerializer
from .language import LanguageSerializer
from .environment import EnvironmentSerializer
from .size import SizeSerializer
from drf_spectacular.utils import extend_schema_field, inline_serializer
from drf_spectacular.types import OpenApiTypes
Expand Down Expand Up @@ -63,6 +65,8 @@ class CreatureSerializer(GameContentSerializer):
document = DocumentSerializer()
type = CreatureTypeSerializer()
size = SizeSerializer()
languages = LanguageSerializer(many=True)
environments = EnvironmentSerializer(many=True)

class Meta:
'''Serializer meta options.'''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,52 @@
"darkvision_range": 120.0,
"document": "http://localhost:8000/v2/documents/srd/",
"environments": [
"http://localhost:8000/v2/environments/hills/",
"http://localhost:8000/v2/environments/mountain/"
{
"aquatic": false,
"desc": "[None Provided]",
"document": "http://localhost:8000/v2/documents/open5e-e/",
"interior": false,
"key": "hills",
"name": "Hills",
"planar": false,
"url": "http://localhost:8000/v2/environments/hills/"
},
{
"aquatic": false,
"desc": "[None provided]",
"document": "http://localhost:8000/v2/documents/open5e-e/",
"interior": false,
"key": "mountain",
"name": "Mountain",
"planar": false,
"url": "http://localhost:8000/v2/environments/mountain/"
}
],
"experience_points": 62000,
"hit_dice": "28d20+252",
"hit_points": 546,
"key": "srd_ancient-red-dragon",
"languages": [
"http://localhost:8000/v2/languages/common/",
"http://localhost:8000/v2/languages/draconic/"
{
"desc": "Typical speakers are Humans.",
"document": "http://localhost:8000/v2/documents/srd/",
"is_exotic": false,
"is_secret": false,
"key": "common",
"name": "Common",
"script_language": "http://localhost:8000/v2/languages/common/",
"url": "http://localhost:8000/v2/languages/common/"
},
{
"desc": "Typical speakers include dragons and dragonborn.",
"document": "http://localhost:8000/v2/documents/srd/",
"is_exotic": true,
"is_secret": false,
"key": "draconic",
"name": "Draconic",
"script_language": "http://localhost:8000/v2/languages/draconic/",
"url": "http://localhost:8000/v2/languages/draconic/"
}
],
"modifiers": {
"charisma": 6,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,27 +47,162 @@
"darkvision_range": 60.0,
"document": "http://localhost:8000/v2/documents/srd/",
"environments": [
"http://localhost:8000/v2/environments/arctic/",
"http://localhost:8000/v2/environments/caves/",
"http://localhost:8000/v2/environments/desert/",
"http://localhost:8000/v2/environments/forest/",
"http://localhost:8000/v2/environments/grassland/",
"http://localhost:8000/v2/environments/hills/",
"http://localhost:8000/v2/environments/mountain/",
"http://localhost:8000/v2/environments/ruins/",
"http://localhost:8000/v2/environments/sewer/",
"http://localhost:8000/v2/environments/srd_feywild/",
"http://localhost:8000/v2/environments/swamp/",
"http://localhost:8000/v2/environments/underworld/",
"http://localhost:8000/v2/environments/urban/"
{
"aquatic": false,
"desc": "[None provided]",
"document": "http://localhost:8000/v2/documents/open5e-e/",
"interior": false,
"key": "arctic",
"name": "Arctic or Tundra",
"planar": false,
"url": "http://localhost:8000/v2/environments/arctic/"
},
{
"aquatic": false,
"desc": "Caves and caverns",
"document": "http://localhost:8000/v2/documents/open5e-e/",
"interior": true,
"key": "caves",
"name": "Caves",
"planar": false,
"url": "http://localhost:8000/v2/environments/caves/"
},
{
"aquatic": false,
"desc": "[None provided]",
"document": "http://localhost:8000/v2/documents/open5e-e/",
"interior": false,
"key": "desert",
"name": "Desert",
"planar": false,
"url": "http://localhost:8000/v2/environments/desert/"
},
{
"aquatic": false,
"desc": "[None provided]",
"document": "http://localhost:8000/v2/documents/open5e-e/",
"interior": false,
"key": "forest",
"name": "Forest or Jungle",
"planar": false,
"url": "http://localhost:8000/v2/environments/forest/"
},
{
"aquatic": false,
"desc": "[None provided]",
"document": "http://localhost:8000/v2/documents/open5e-e/",
"interior": false,
"key": "grassland",
"name": "Grassland or Plains",
"planar": false,
"url": "http://localhost:8000/v2/environments/grassland/"
},
{
"aquatic": false,
"desc": "[None Provided]",
"document": "http://localhost:8000/v2/documents/open5e-e/",
"interior": false,
"key": "hills",
"name": "Hills",
"planar": false,
"url": "http://localhost:8000/v2/environments/hills/"
},
{
"aquatic": false,
"desc": "[None provided]",
"document": "http://localhost:8000/v2/documents/open5e-e/",
"interior": false,
"key": "mountain",
"name": "Mountain",
"planar": false,
"url": "http://localhost:8000/v2/environments/mountain/"
},
{
"aquatic": false,
"desc": "[None provided]",
"document": "http://localhost:8000/v2/documents/open5e-e/",
"interior": true,
"key": "ruins",
"name": "Ruins",
"planar": false,
"url": "http://localhost:8000/v2/environments/ruins/"
},
{
"aquatic": false,
"desc": "[None provided]",
"document": "http://localhost:8000/v2/documents/open5e-e/",
"interior": true,
"key": "sewer",
"name": "Sewer",
"planar": false,
"url": "http://localhost:8000/v2/environments/sewer/"
},
{
"aquatic": false,
"desc": "[None provided]",
"document": "http://localhost:8000/v2/documents/open5e-e/",
"interior": false,
"key": "srd_feywild",
"name": "Feywild",
"planar": false,
"url": "http://localhost:8000/v2/environments/srd_feywild/"
},
{
"aquatic": false,
"desc": "[None provided]",
"document": "http://localhost:8000/v2/documents/open5e-e/",
"interior": false,
"key": "swamp",
"name": "Swamp or Marsh",
"planar": false,
"url": "http://localhost:8000/v2/environments/swamp/"
},
{
"aquatic": false,
"desc": "[None Provided]",
"document": "http://localhost:8000/v2/documents/open5e-e/",
"interior": false,
"key": "underworld",
"name": "Underworld",
"planar": false,
"url": "http://localhost:8000/v2/environments/underworld/"
},
{
"aquatic": false,
"desc": "[None provided]",
"document": "http://localhost:8000/v2/documents/open5e-e/",
"interior": false,
"key": "urban",
"name": "Urban",
"planar": false,
"url": "http://localhost:8000/v2/environments/urban/"
}
],
"experience_points": 50,
"hit_dice": "2d6",
"hit_points": 7,
"key": "srd_goblin",
"languages": [
"http://localhost:8000/v2/languages/common/",
"http://localhost:8000/v2/languages/goblin/"
{
"desc": "Typical speakers are Humans.",
"document": "http://localhost:8000/v2/documents/srd/",
"is_exotic": false,
"is_secret": false,
"key": "common",
"name": "Common",
"script_language": "http://localhost:8000/v2/languages/common/",
"url": "http://localhost:8000/v2/languages/common/"
},
{
"desc": "Typical speakers are goblinoids.",
"document": "http://localhost:8000/v2/documents/srd/",
"is_exotic": false,
"is_secret": false,
"key": "goblin",
"name": "Goblin",
"script_language": "http://localhost:8000/v2/languages/dwarvish/",
"url": "http://localhost:8000/v2/languages/goblin/"
}
],
"modifiers": {
"charisma": -1,
Expand Down
Loading
Loading