docs: update OAS of reset password routes (#11711)

This commit is contained in:
Shahed Nasser
2025-03-04 13:28:41 +02:00
committed by GitHub
parent 7dbec10b3b
commit c2e24b6cfd
6 changed files with 34 additions and 19 deletions

View File

@@ -1,6 +1,7 @@
import { useBaseSpecs } from "@/providers/base-specs"
import type { OpenAPIV3 } from "openapi-types"
import { Card } from "docs-ui"
import { useMemo } from "react"
export type TagsOperationDescriptionSectionSecurityProps = {
security: OpenAPIV3.SecurityRequirementObject[]
@@ -11,6 +12,15 @@ const TagsOperationDescriptionSectionSecurity = ({
}: TagsOperationDescriptionSectionSecurityProps) => {
const { getSecuritySchema } = useBaseSpecs()
const linkToAuth = useMemo(() => {
const hasNoAuth = security.some((item) => {
const schema = getSecuritySchema(Object.keys(item)[0])
return schema && schema["x-is-auth"] === false
})
return !hasNoAuth
}, [security, getSecuritySchema])
const getDescription = () => {
let str = ""
security.forEach((item) => {
@@ -27,7 +37,7 @@ const TagsOperationDescriptionSectionSecurity = ({
<Card
title="Authorization"
text={getDescription()}
href="#authentication"
href={linkToAuth ? "#authentication" : undefined}
/>
</div>
)