OpenAPI: support unsetting auth fields in playground

This commit is contained in:
Fuma Nama
2026-03-20 10:49:19 +08:00
parent e201942622
commit 440b95408e
2 changed files with 7 additions and 6 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'fumadocs-openapi': patch
---
support unsetting auth fields in playground
+2 -6
View File
@@ -513,7 +513,8 @@ function useAuthInputs(
},
mapOutput(out) {
if (out && typeof out === 'object') {
return `Basic ${btoa(`${'username' in out ? out.username : ''}:${'password' in out ? out.password : ''}`)}`;
const obj = out as Record<string, unknown>;
return `Basic ${btoa(`${obj.username ?? ''}:${obj.password ?? ''}`)}`;
}
return out;
@@ -530,7 +531,6 @@ function useAuthInputs(
type: 'string',
},
},
required: ['username', 'password'],
}}
fieldName={fieldName}
/>
@@ -551,7 +551,6 @@ function useAuthInputs(
<div className="flex gap-2">
<FieldInput
fieldName={fieldName}
isRequired
field={{
type: 'string',
}}
@@ -584,7 +583,6 @@ function useAuthInputs(
<FieldSet
name={`${t.authorization} (${t.header})`}
fieldName={fieldName}
isRequired
field={{
type: 'string',
}}
@@ -602,7 +600,6 @@ function useAuthInputs(
<FieldSet
fieldName={fieldName}
name={`${security.name} (${security.in})`}
isRequired
field={{
type: 'string',
}}
@@ -620,7 +617,6 @@ function useAuthInputs(
<>
<FieldSet
name={`${t.authorization} (${t.header})`}
isRequired
fieldName={fieldName}
field={{
type: 'string',