Skip to content
Open
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
56 changes: 27 additions & 29 deletions openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pokemon_v2/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
3 changes: 2 additions & 1 deletion pokemon_v2/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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<pokemon_id>\d+)/encounters",
Expand Down
Loading