@midwayjs/swagger 3.20.6-beta.1 → 3.20.6-beta.2

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.
@@ -283,7 +283,7 @@ export interface AuthOptions extends Omit<SecuritySchemeObject, 'type'> {
283
283
  /**
284
284
  * 添加全局默认要求
285
285
  */
286
- addSecurityRequirements: boolean;
286
+ addSecurityRequirements?: boolean;
287
287
  }
288
288
  /**
289
289
  * see https://swagger.io/specification/
@@ -225,7 +225,11 @@ let SwaggerExplorer = class SwaggerExplorer {
225
225
  return item.key === constants_1.DECORATORS.API_EXCLUDE_SECURITY;
226
226
  });
227
227
  // 如果存在安全信息,则将其添加到路径中
228
- if (security.length > 0 && !excludeSecurity) {
228
+ if (excludeSecurity) {
229
+ // 显式设置为空数组,覆盖全局 security
230
+ paths[url][webRouter.requestMethod].security = [];
231
+ }
232
+ else if (security.length > 0) {
229
233
  if (!paths[url][webRouter.requestMethod].security) {
230
234
  paths[url][webRouter.requestMethod].security = [];
231
235
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midwayjs/swagger",
3
- "version": "3.20.6-beta.1",
3
+ "version": "3.20.6-beta.2",
4
4
  "main": "dist/index.js",
5
5
  "typings": "index.d.ts",
6
6
  "files": [