diff --git a/openapi.yml b/openapi.yml index 7f4f0b5c6..8f9187619 100644 --- a/openapi.yml +++ b/openapi.yml @@ -13,6 +13,33 @@ info: around the world. Pokémon and Pokémon character names are trademarks of Nintendo.\n \ " paths: + /api/v2/meta/: + get: + operationId: meta_retrieve + description: Returns metadata about the current deployed version of the API, + including the git commit hash, deploy date, and tag (if any). + summary: Get API metadata + tags: + - utility + security: + - {} + responses: + '200': + content: + application/json: + schema: + type: object + properties: + deploy_date: + type: string + nullable: true + hash: + type: string + nullable: true + tag: + type: string + nullable: true + description: '' /api/v2/ability/: get: operationId: ability_list @@ -1539,35 +1566,6 @@ paths: schema: $ref: '#/components/schemas/MachineDetail' description: '' - /api/v2/meta/: - get: - operationId: meta_list - description: Returns metadata about the current deployed version of the API, - including the git commit hash, deploy date, and tag (if any). - summary: Get API metadata - tags: - - utility - security: - - {} - responses: - '200': - content: - application/json: - schema: - type: array - items: - type: object - properties: - deploy_date: - type: string - nullable: true - hash: - type: string - nullable: true - tag: - type: string - nullable: true - description: '' /api/v2/move/: get: operationId: move_list diff --git a/pokemon_v2/api.py b/pokemon_v2/api.py index 927987d3a..ea9cd983f 100644 --- a/pokemon_v2/api.py +++ b/pokemon_v2/api.py @@ -1082,8 +1082,8 @@ def get(self, request, pokemon_id): } }, ) -class PokeapiMetaViewset(viewsets.ViewSet): - def list(self, request): +class PokeapiMetaView(APIView): + def get(self, request): try: git_hash = ( subprocess.check_output( diff --git a/pokemon_v2/urls.py b/pokemon_v2/urls.py index 8360d6e6b..17dcaf436 100644 --- a/pokemon_v2/urls.py +++ b/pokemon_v2/urls.py @@ -38,7 +38,7 @@ router.register(r"location", LocationResource) router.register(r"location-area", LocationAreaResource) router.register(r"machine", MachineResource) -router.register(r"meta", PokeapiMetaViewset, basename="meta") + router.register(r"move", MoveResource) router.register(r"move-ailment", MoveMetaAilmentResource) router.register(r"move-battle-style", MoveBattleStyleResource) @@ -71,6 +71,7 @@ ########################### urlpatterns = [ + path("api/v2/meta/", PokeapiMetaView.as_view(), name="meta"), path("api/v2/", include(router.urls)), re_path( r"^api/v2/pokemon/(?P\d+)/encounters",