| 959 | |
| 960 | |
| 961 | class LocationAreaDetailSerializer(serializers.ModelSerializer): |
| 962 | location = LocationSummarySerializer() |
| 963 | encounter_method_rates = serializers.SerializerMethodField("get_method_rates") |
| 964 | pokemon_encounters = serializers.SerializerMethodField("get_encounters") |
| 965 | names = LocationAreaNameSerializer( |
| 966 | many=True, read_only=True, source="locationareaname" |
| 967 | ) |
| 968 | |
| 969 | class Meta: |
| 970 | model = LocationArea |
| 971 | fields = ( |
| 972 | "id", |
| 973 | "name", |
| 974 | "game_index", |
| 975 | "encounter_method_rates", |
| 976 | "location", |
| 977 | "names", |
| 978 | "pokemon_encounters", |
| 979 | ) |
| 980 | |
| 981 | @extend_schema_field( |
| 982 | field={ |
| 983 | "type": "array", |
| 984 | "items": { |
| 985 | "type": "object", |
| 986 | "required": ["encounter_method", "version_details"], |
| 987 | "properties": { |
| 988 | "encounter_method": { |
| 989 | "type": "object", |
| 990 | "required": ["name", "url"], |
| 991 | "properties": { |
| 992 | "name": {"type": "string", "examples": ["old-rod"]}, |
| 993 | "url": { |
| 994 | "type": "string", |
| 995 | "format": "uri", |
| 996 | "examples": [ |
| 997 | "https://pokeapi.co/api/v2/encounter-method/2/" |
| 998 | ], |
| 999 | }, |
| 1000 | }, |
| 1001 | }, |
| 1002 | "version_details": { |
| 1003 | "type": "array", |
| 1004 | "items": { |
| 1005 | "type": "object", |
| 1006 | "required": ["rate", "version"], |
| 1007 | "properties": { |
| 1008 | "rate": { |
| 1009 | "type": "integer", |
| 1010 | "format": "int32", |
| 1011 | "examples": [5], |
| 1012 | }, |
| 1013 | "version": { |
| 1014 | "type": "object", |
| 1015 | "required": ["name", "url"], |
| 1016 | "properties": { |
| 1017 | "name": { |
| 1018 | "type": "string", |
nothing calls this directly
no test coverage detected