mirror of
https://github.com/hanzo-docs/docs.git
synced 2026-10-25 04:20:02 +00:00
OpenAPI: Improve error message
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'fumadocs-openapi': patch
|
||||
---
|
||||
|
||||
Improve error message
|
||||
@@ -135,7 +135,7 @@ function getAuthorizationField(
|
||||
|
||||
if (!item) {
|
||||
console.warn(
|
||||
`Cannot find suitable security schema for API Playground from ${JSON.stringify(security, null, 2)}. Only one requirement is allowed`,
|
||||
`Cannot find suitable security scheme for API Playground from ${JSON.stringify(security, null, 2)}. Only schemes with one requirement are allowed.`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,10 @@ export function getSecurities(
|
||||
const schemas = document.components?.securitySchemes ?? {};
|
||||
|
||||
for (const [key, scopes] of Object.entries(requirement)) {
|
||||
if (!(key in schemas)) return [];
|
||||
if (!(key in schemas))
|
||||
throw new Error(
|
||||
`Security scheme with name ${key} is not found, make sure to define referenced schemes.`,
|
||||
);
|
||||
const schema = schemas[key];
|
||||
|
||||
results.push({
|
||||
|
||||
Reference in New Issue
Block a user