feat(api-docs): add error responses to API documentation

This commit is contained in:
Daniel Hougaard
2024-09-27 20:02:43 +04:00
parent 2d51ed317f
commit 7ac4b0b79f
39 changed files with 297 additions and 14 deletions
@@ -9,6 +9,8 @@ import { AuthMode } from "@app/services/auth/auth-type";
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
import { validateAzureAuthField } from "@app/services/identity-azure-auth/identity-azure-auth-validators";
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
export const registerIdentityAzureAuthRouter = async (server: FastifyZodProvider) => {
server.route({
method: "POST",
@@ -23,6 +25,7 @@ export const registerIdentityAzureAuthRouter = async (server: FastifyZodProvider
jwt: z.string()
}),
response: {
...DefaultResponseErrorsSchema,
200: z.object({
accessToken: z.string(),
expiresIn: z.coerce.number(),
@@ -108,6 +111,7 @@ export const registerIdentityAzureAuthRouter = async (server: FastifyZodProvider
accessTokenNumUsesLimit: z.number().int().min(0).default(0).describe(AZURE_AUTH.ATTACH.accessTokenNumUsesLimit)
}),
response: {
...DefaultResponseErrorsSchema,
200: z.object({
identityAzureAuth: IdentityAzureAuthsSchema
})
@@ -188,6 +192,7 @@ export const registerIdentityAzureAuthRouter = async (server: FastifyZodProvider
.describe(AZURE_AUTH.UPDATE.accessTokenMaxTTL)
}),
response: {
...DefaultResponseErrorsSchema,
200: z.object({
identityAzureAuth: IdentityAzureAuthsSchema
})
@@ -242,6 +247,7 @@ export const registerIdentityAzureAuthRouter = async (server: FastifyZodProvider
identityId: z.string().describe(AZURE_AUTH.RETRIEVE.identityId)
}),
response: {
...DefaultResponseErrorsSchema,
200: z.object({
identityAzureAuth: IdentityAzureAuthsSchema
})
@@ -289,6 +295,7 @@ export const registerIdentityAzureAuthRouter = async (server: FastifyZodProvider
identityId: z.string().describe(AZURE_AUTH.REVOKE.identityId)
}),
response: {
...DefaultResponseErrorsSchema,
200: z.object({
identityAzureAuth: IdentityAzureAuthsSchema
})