mirror of
https://github.com/LukeHagar/redocly-cli.git
synced 2025-12-06 12:47:48 +00:00
fix: join command security schemas fix (#1439)
This commit is contained in:
5
.changeset/little-camels-fold.md
Normal file
5
.changeset/little-camels-fold.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@redocly/cli": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Adds support for using logical AND for the security schema so that the `join` command generates the correct schema.
|
||||||
@@ -19,7 +19,11 @@ paths:
|
|||||||
responses:
|
responses:
|
||||||
'201':
|
'201':
|
||||||
description: example description
|
description: example description
|
||||||
|
security:
|
||||||
|
- scheme1: []
|
||||||
|
scheme2: []
|
||||||
|
- scheme3: []
|
||||||
|
scheme4: []
|
||||||
components:
|
components:
|
||||||
schemas:
|
schemas:
|
||||||
some-property:
|
some-property:
|
||||||
|
|||||||
@@ -27,7 +27,11 @@ paths:
|
|||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: example description
|
description: example description
|
||||||
|
security:
|
||||||
|
- scheme1: []
|
||||||
|
scheme2: []
|
||||||
|
scheme3: []
|
||||||
|
scheme4: []
|
||||||
components:
|
components:
|
||||||
schemas:
|
schemas:
|
||||||
some-property:
|
some-property:
|
||||||
|
|||||||
@@ -39,6 +39,11 @@ paths:
|
|||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: example description
|
description: example description
|
||||||
|
security:
|
||||||
|
- Foo Example OpenAPI 3 definition foo._scheme1: []
|
||||||
|
Foo Example OpenAPI 3 definition foo._scheme2: []
|
||||||
|
Foo Example OpenAPI 3 definition foo._scheme3: []
|
||||||
|
Foo Example OpenAPI 3 definition foo._scheme4: []
|
||||||
tags:
|
tags:
|
||||||
- foo_other
|
- foo_other
|
||||||
/pets/{petId}:
|
/pets/{petId}:
|
||||||
@@ -48,6 +53,11 @@ paths:
|
|||||||
responses:
|
responses:
|
||||||
'201':
|
'201':
|
||||||
description: example description
|
description: example description
|
||||||
|
security:
|
||||||
|
- Bar Example OpenAPI 3 definition._scheme1: []
|
||||||
|
Bar Example OpenAPI 3 definition._scheme2: []
|
||||||
|
- Bar Example OpenAPI 3 definition._scheme3: []
|
||||||
|
Bar Example OpenAPI 3 definition._scheme4: []
|
||||||
tags:
|
tags:
|
||||||
- bar_other
|
- bar_other
|
||||||
components:
|
components:
|
||||||
|
|||||||
@@ -756,8 +756,11 @@ function addComponentsPrefix(description: string, componentsPrefix: string) {
|
|||||||
function addSecurityPrefix(security: any, componentsPrefix: string) {
|
function addSecurityPrefix(security: any, componentsPrefix: string) {
|
||||||
return componentsPrefix
|
return componentsPrefix
|
||||||
? security?.map((s: any) => {
|
? security?.map((s: any) => {
|
||||||
const key = Object.keys(s)[0];
|
const joinedSecuritySchema = {};
|
||||||
return { [componentsPrefix + '_' + key]: s[key] };
|
for (const [key, value] of Object.entries(s)) {
|
||||||
|
Object.assign(joinedSecuritySchema, { [componentsPrefix + '_' + key]: value });
|
||||||
|
}
|
||||||
|
return joinedSecuritySchema;
|
||||||
})
|
})
|
||||||
: security;
|
: security;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user