📝 docs: add schema documentation to OAuth provider routes

This commit is contained in:
2026-02-25 12:00:00 +07:00
parent 97dc26ed82
commit a6200605f8
3 changed files with 60 additions and 3 deletions

View File

@ -9,8 +9,8 @@ export const getOauthProvidersController = (ctx: Context) => {
return returnReadResponse( return returnReadResponse(
ctx.set, ctx.set,
200, 200,
"Getting all oauth available list", "Successfully retrieved the list of oauth providers",
oauthProviderServices oauthProviderServices,
); );
} catch (error) { } catch (error) {
return mainErrorHandler(ctx.set, error); return mainErrorHandler(ctx.set, error);

View File

@ -8,10 +8,11 @@ import { getCallbackProviderUrlController } from "./controllers/getCallbackProvi
import { tokenValidationController } from "./controllers/tokenValidation.controller"; import { tokenValidationController } from "./controllers/tokenValidation.controller";
import { logoutController } from "./controllers/logout.controller"; import { logoutController } from "./controllers/logout.controller";
import { tokenValidationSchema } from "./schemas/tokenValidation.schema"; import { tokenValidationSchema } from "./schemas/tokenValidation.schema";
import { getOauthProvidersSchema } from "./schemas/getOauthProviders.schema";
export const authModule = new Elysia({ prefix: "/auth", tags: ["Authentication"] }) export const authModule = new Elysia({ prefix: "/auth", tags: ["Authentication"] })
.post("/token/validate", tokenValidationController, tokenValidationSchema) .post("/token/validate", tokenValidationController, tokenValidationSchema)
.get("/providers", getOauthProvidersController) .get("/providers", getOauthProvidersController, getOauthProvidersSchema)
.get("/providers/:name/callback", getCallbackProviderUrlController) .get("/providers/:name/callback", getCallbackProviderUrlController)
.get("/github", githubRequestController) .get("/github", githubRequestController)
.get("/github/callback", githubCallbackController) .get("/github/callback", githubCallbackController)

View File

@ -0,0 +1,56 @@
import { success } from "zod";
import { AppRouteSchema } from "../../../helpers/types/AppRouteSchema";
export const getOauthProvidersSchema = {
detail: {
summary: "Get all available oauth providers",
description:
"This endpoint returns a list of all available and active oauth providers that can be used for authentication.",
responses: {
200: {
description: "Successfully retrieved the list of oauth providers",
content: {
"application/json": {
schema: {
type: "object",
properties: {
success: {
type: "boolean",
example: true,
},
status: {
type: "number",
example: 200,
},
message: {
type: "string",
example: "Successfully retrieved the list of oauth providers",
},
data: {
type: "array",
items: {
type: "object",
properties: {
name: {
type: "string",
example: "google",
},
icon: {
type: "string",
example: "logos:google-icon",
},
req_endpoint: {
type: "string",
example: "auth/google",
},
},
},
},
},
},
},
},
},
},
},
} satisfies AppRouteSchema;