Skip to content

Commit

Permalink
Fixes #87: added summary to all openapi endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
dolamroth committed Sep 23, 2024
1 parent e36632c commit bf9d81d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
8 changes: 8 additions & 0 deletions starlette_web/contrib/auth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ class SignInAPIView(JWTSessionMixin, BaseHTTPEndpoint):

async def post(self, request):
"""
summary: Sign in
description: Sign in
requestBody:
required: true
Expand Down Expand Up @@ -160,6 +161,7 @@ class SignUpAPIView(JWTSessionMixin, BaseHTTPEndpoint):

async def post(self, request):
"""
summary: Sign up
description: Sign up
requestBody:
required: true
Expand Down Expand Up @@ -239,6 +241,7 @@ class SignOutAPIView(BaseHTTPEndpoint):

async def delete(self, request):
"""
summary: Sign out
description: Sign out
responses:
200:
Expand Down Expand Up @@ -272,6 +275,7 @@ class RefreshTokenAPIView(JWTSessionMixin, BaseHTTPEndpoint):

async def post(self, request):
"""
summary: Update refresh token
description: Update refresh token
requestBody:
required: true
Expand Down Expand Up @@ -330,6 +334,7 @@ class InviteUserAPIView(BaseHTTPEndpoint):

async def post(self, request):
"""
summary: Invite user
description: Invite user
requestBody:
required: true
Expand Down Expand Up @@ -419,6 +424,7 @@ class ResetPasswordAPIView(BaseHTTPEndpoint):

async def post(self, request):
"""
summary: Reset password
description: Reset password
requestBody:
required: true
Expand Down Expand Up @@ -489,6 +495,7 @@ class ChangePasswordAPIView(JWTSessionMixin, BaseHTTPEndpoint):

async def post(self, request):
"""
summary: Change password
description: Change password
requestBody:
required: true
Expand Down Expand Up @@ -530,6 +537,7 @@ class ProfileApiView(BaseHTTPEndpoint):

async def get(self, request):
"""
summary: Profile info
description: Profile info
responses:
200:
Expand Down
16 changes: 14 additions & 2 deletions starlette_web/tests/contrib/test_apispec.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"paths": {
"/api/auth/me/": {
"get": {
"summary": "Profile info",
"description": "Profile info",
"responses": {
"200": {
Expand Down Expand Up @@ -45,6 +46,7 @@
},
"/api/auth/sign-in/": {
"post": {
"summary": "Sign in",
"description": "Sign in",
"requestBody": {
"required": True,
Expand Down Expand Up @@ -96,6 +98,7 @@
},
"/api/auth/sign-up/": {
"post": {
"summary": "Sign up",
"description": "Sign up",
"requestBody": {
"required": True,
Expand Down Expand Up @@ -137,6 +140,7 @@
},
"/api/auth/sign-out/": {
"delete": {
"summary": "Sign out",
"description": "Sign out",
"responses": {
"200": {
Expand Down Expand Up @@ -165,6 +169,7 @@
},
"/api/auth/refresh-token/": {
"post": {
"summary": "Update refresh token",
"description": "Update refresh token",
"requestBody": {
"required": True,
Expand Down Expand Up @@ -216,6 +221,7 @@
},
"/api/auth/invite-user/": {
"post": {
"summary": "Invite user",
"description": "Invite user",
"requestBody": {
"required": True,
Expand Down Expand Up @@ -272,6 +278,7 @@
},
"/api/auth/reset-password/": {
"post": {
"summary": "Reset password",
"description": "Reset password",
"requestBody": {
"required": True,
Expand Down Expand Up @@ -338,6 +345,7 @@
},
"/api/auth/change-password/": {
"post": {
"summary": "Change password",
"description": "Change password",
"requestBody": {
"required": True,
Expand Down Expand Up @@ -382,6 +390,7 @@
},
"/health_check/": {
"get": {
"summary": "Health check",
"description": "Health check of services",
"responses": {
"200": {
Expand All @@ -405,6 +414,7 @@
},
"/typed-schema/": {
"post": {
"summary": "TypedMethodField",
"description": "Endpoint with typed method field",
"requestBody": {
"required": True,
Expand Down Expand Up @@ -446,7 +456,8 @@
},
"/{alias}/": {
"get": {
"description": "Empty response for test",
"summary": "Empty response",
"description": "Empty response (204) for test",
"responses": {
"204": {
"description": "Empty response for test"
Expand All @@ -469,7 +480,8 @@
},
"/{alias1}/{alias2}/": {
"get": {
"description": "Empty response for test",
"summary": "Empty response",
"description": "Empty response (204) for test",
"responses": {
"204": {
"description": "Empty response for test"
Expand Down
5 changes: 4 additions & 1 deletion starlette_web/tests/views/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class HealthCheckAPIView(BaseHTTPEndpoint):

async def get(self, *_):
"""
summary: Health check
description: Health check of services
responses:
200:
Expand Down Expand Up @@ -72,7 +73,8 @@ class EmptyResponseAPIView(BaseHTTPEndpoint):

async def get(self, *_):
"""
description: Empty response for test
summary: Empty response
description: Empty response (204) for test
responses:
204:
description: Empty response for test
Expand Down Expand Up @@ -101,6 +103,7 @@ class EndpointWithTypedMethodSchema(BaseHTTPEndpoint):

async def post(self, request):
"""
summary: TypedMethodField
description: Endpoint with typed method field
requestBody:
required: true
Expand Down

0 comments on commit bf9d81d

Please sign in to comment.