MCPcopy Index your code
hub / github.com/PokeAPI/pokeapi / StatDetailSerializer

Class StatDetailSerializer

pokemon_v2/serializers.py:1416–1570  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1414
1415
1416class StatDetailSerializer(serializers.ModelSerializer):
1417 names = StatNameSerializer(many=True, read_only=True, source="statname")
1418 move_damage_class = MoveDamageClassSummarySerializer()
1419 characteristics = CharacteristicSummarySerializer(
1420 many=True, read_only=True, source="characteristic"
1421 )
1422 affecting_moves = serializers.SerializerMethodField("get_moves_that_affect")
1423 affecting_natures = serializers.SerializerMethodField("get_natures_that_affect")
1424
1425 class Meta:
1426 model = Stat
1427 fields = (
1428 "id",
1429 "name",
1430 "game_index",
1431 "is_battle_only",
1432 "affecting_moves",
1433 "affecting_natures",
1434 "characteristics",
1435 "move_damage_class",
1436 "names",
1437 )
1438
1439 @extend_schema_field(
1440 field={
1441 "type": "object",
1442 "required": ["decrease", "increase"],
1443 "properties": {
1444 "increase": {
1445 "type": "array",
1446 "items": {
1447 "type": "object",
1448 "required": ["change", "move"],
1449 "properties": {
1450 "change": {
1451 "type": "integer",
1452 "format": "int32",
1453 "examples": [-1],
1454 },
1455 "move": {
1456 "type": "object",
1457 "required": ["name", "url"],
1458 "properties": {
1459 "name": {
1460 "type": "string",
1461 "examples": ["swords-dance"],
1462 },
1463 "url": {
1464 "type": "string",
1465 "format": "uri",
1466 "examples": [
1467 "https://pokeapi.co/api/v2/move/14/"
1468 ],
1469 },
1470 },
1471 },
1472 },
1473 },

Callers

nothing calls this directly

Tested by

no test coverage detected