vite-plugin-openapi-codegen 3.0.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +3 -3
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +3 -3
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -670,9 +670,9 @@ function readSecurityRequirement(entry, securitySchemes, topLevelSecurity) {
|
|
|
670
670
|
const requirement = security[0];
|
|
671
671
|
if (!isRecord(requirement)) throw new Error(`Operation "${entry.operationId}" has an invalid security requirement`);
|
|
672
672
|
for (const [schemeName, scopes] of Object.entries(requirement)) {
|
|
673
|
-
const
|
|
674
|
-
if (type === "apiKey") return { kind: "internal" };
|
|
675
|
-
if (type === "http") {
|
|
673
|
+
const scheme = securitySchemes?.[schemeName];
|
|
674
|
+
if (scheme?.type === "apiKey" && scheme.in === "header") return { kind: "internal" };
|
|
675
|
+
if (scheme?.type === "http" || scheme?.type === "apiKey" && scheme.in === "cookie") {
|
|
676
676
|
const roles = Array.isArray(scopes) ? scopes.filter((scope) => typeof scope === "string") : [];
|
|
677
677
|
return roles.length === 0 ? { kind: "authenticated" } : {
|
|
678
678
|
kind: "role",
|
package/dist/index.d.mts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -668,9 +668,9 @@ function readSecurityRequirement(entry, securitySchemes, topLevelSecurity) {
|
|
|
668
668
|
const requirement = security[0];
|
|
669
669
|
if (!isRecord(requirement)) throw new Error(`Operation "${entry.operationId}" has an invalid security requirement`);
|
|
670
670
|
for (const [schemeName, scopes] of Object.entries(requirement)) {
|
|
671
|
-
const
|
|
672
|
-
if (type === "apiKey") return { kind: "internal" };
|
|
673
|
-
if (type === "http") {
|
|
671
|
+
const scheme = securitySchemes?.[schemeName];
|
|
672
|
+
if (scheme?.type === "apiKey" && scheme.in === "header") return { kind: "internal" };
|
|
673
|
+
if (scheme?.type === "http" || scheme?.type === "apiKey" && scheme.in === "cookie") {
|
|
674
674
|
const roles = Array.isArray(scopes) ? scopes.filter((scope) => typeof scope === "string") : [];
|
|
675
675
|
return roles.length === 0 ? { kind: "authenticated" } : {
|
|
676
676
|
kind: "role",
|