Skip to content

Commit bd3b2ed

Browse files
committed
fix: rename x-security-scheme-name-link to x-security-scheme-name-reference and update related documentation and tests
1 parent 198c7fe commit bd3b2ed

20 files changed

+78
-82
lines changed

__tests__/lint/x-security-scheme-name-link-rule/redocly.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ apis:
22
main:
33
root: ./museum.yaml
44
rules:
5-
x-security-scheme-name-link: error
5+
x-security-scheme-name-reference: error

__tests__/lint/x-security-scheme-name-link-rule/snapshot.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[1] museum.yaml:15:21 at #/workflows/0/x-security/0/schemeName
22

3-
When multiple `sourceDescriptions` exist, `workflow.x-security.schemeName` must be a link to a source description (e.g. `$sourceDescriptions.{name}.{scheme}`)
3+
When multiple `sourceDescriptions` exist, `workflow.x-security.schemeName` must be a reference to a source description (e.g. `$sourceDescriptions.{name}.{scheme}`)
44

55
13 | - workflowId: get-museum-hours
66
14 | x-security:
@@ -9,7 +9,7 @@ When multiple `sourceDescriptions` exist, `workflow.x-security.schemeName` must
99
16 | values:
1010
17 | token: some-token
1111

12-
Error was generated by the x-security-scheme-name-link rule.
12+
Error was generated by the x-security-scheme-name-reference rule.
1313

1414

1515

docs/@v2/rules/built-in-rules.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,6 @@ Within the Arazzo family of rules, there are rules for the main Arazzo specifica
136136
- [workflow-dependsOn](./arazzo/workflow-dependsOn.md): the items in the `workflow` `dependsOn` property must exist and be unique
137137
- [workflowId-unique](./arazzo/workflowId-unique.md): the `workflowId` property must be unique across all workflows
138138
- [sourceDescriptions-not-empty](./arazzo/sourceDescriptions-not-empty.md): the `sourceDescriptions` must be defined and the list must have at least one entry.
139-
- [x-security-scheme-name-link](./arazzo/x-security-scheme-name-link.md): when multiple `sourceDescriptions` exist, `workflow.x-security.schemeName` must link to a source description (for example, `$sourceDescriptions.{name}.scheme`)
140-
- [no-x-security-both-scheme-and-scheme-name](./arazzo/no-x-security-both-scheme-and-scheme-name.md): forbids using both `scheme` and `schemeName` in the same `x-security` item
141139

142140
### Respect
143141

@@ -147,6 +145,8 @@ The below rules are being migrated to Respect:
147145
- [respect-supported-versions](./respect/respect-supported-versions.md): the `version` property must be one of the supported values.
148146
- [no-x-security-scheme-name-without-openapi](./respect/no-x-security-scheme-name-without-openapi.md): the `x-security` can't use `schemeName` when Step request is described with `x-operation`.
149147
- [x-security-scheme-required-values](./respect/x-security-scheme-required-values.md) validate that `x-security` have all required `values` described according to the used `scheme`.
148+
- [x-security-scheme-name-reference](./respect/x-security-scheme-name-reference.md): when multiple `sourceDescriptions` exist, `workflow.x-security.schemeName` must reference a source description (for example, `$sourceDescriptions.{name}.scheme`)
149+
- [no-x-security-both-scheme-and-scheme-name](./respect/no-x-security-both-scheme-and-scheme-name.md): forbids using both `scheme` and `schemeName` in the same `x-security` item
150150

151151
## Resources
152152

docs/@v2/rules/arazzo/no-x-security-both-scheme-and-scheme-name.md renamed to docs/@v2/rules/respect/no-x-security-both-scheme-and-scheme-name.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ Forbids using both `scheme` and `schemeName` in the same `x-security` item.
88

99
## Rationale
1010

11-
A single `x-security` item must reference a security scheme in exactly one way: either by embedding the `scheme` object or by referencing it with `schemeName`.
12-
Having both is ambiguous and is rejected by the runtime.
11+
Each `x-security` entry must reference a security scheme in exactly one wayeither embed the `scheme` object or reference it via `schemeName`.
12+
You can include multiple `x-security` entries in a workflow; this rule applies to each entry individually. Using both `scheme` and `schemeName` in the same entry is ambiguous and is rejected by the runtime.
1313

1414
## Configuration
1515

@@ -66,9 +66,9 @@ workflows:
6666

6767
## Related rules
6868

69-
- [x-security-scheme-name-link](./x-security-scheme-name-link.md)
70-
- [x-security-scheme-required-values](../respect/x-security-scheme-required-values.md)
69+
- [x-security-scheme-name-reference](./x-security-scheme-name-reference.md)
70+
- [x-security-scheme-required-values](./x-security-scheme-required-values.md)
7171

7272
## Resources
7373

74-
- Rule source: https://github.com/Redocly/redocly-cli/blob/main/packages/core/src/rules/arazzo/no-x-security-both-scheme-and-scheme-name.ts
74+
- Rule source: https://github.com/Redocly/redocly-cli/blob/main/packages/core/src/rules/respect/no-x-security-both-scheme-and-scheme-name.ts

docs/@v2/rules/arazzo/x-security-scheme-name-link.md renamed to docs/@v2/rules/respect/x-security-scheme-name-reference.md

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
# x-security-scheme-name-link
1+
# x-security-scheme-name-reference
22

3-
When multiple `sourceDescriptions` exist, `workflow.x-security.schemeName` must be a link to a specific source description (for example, `$sourceDescriptions.{name}.scheme`).
4-
If there is only one source description, a plain string is allowed.
3+
When multiple `sourceDescriptions` exist, `workflow.x-security.schemeName` must be a reference to a specific source description (for example, `$sourceDescriptions.{name}.scheme`). If there is only one source description, a plain string is allowed.
54

65
| Arazzo | Compatibility |
76
| ------ | ------------- |
87
| 1.x ||
98

109
## Design principles
1110

12-
With multiple source descriptions, using a plain `schemeName` is ambiguous.
13-
Requiring a link of the form `$sourceDescriptions.{name}.scheme` disambiguates which source description provides the security scheme.
11+
With multiple source descriptions, using a plain `schemeName` is ambiguous. Requiring a reference of the form `$sourceDescriptions.{name}.scheme` disambiguates which source description provides the security scheme.
1412

1513
## Configuration
1614

@@ -22,7 +20,7 @@ An example configuration:
2220

2321
```yaml
2422
rules:
25-
x-security-scheme-name-link: error
23+
x-security-scheme-name-reference: error
2624
```
2725
2826
## Examples
@@ -31,7 +29,7 @@ Given the following configuration:
3129
3230
```yaml
3331
rules:
34-
x-security-scheme-name-link: error
32+
x-security-scheme-name-reference: error
3533
```
3634
3735
Example with multiple source descriptions — incorrect (plain string `schemeName`):
@@ -48,13 +46,13 @@ sourceDescriptions:
4846
workflows:
4947
- workflowId: list-users
5048
x-security:
51-
- schemeName: BasicAuth # <- must be a link when multiple sources exist
49+
- schemeName: BasicAuth # <- must be a reference when multiple sources exist
5250
values:
5351
username: test@example.com
5452
password: 123456
5553
```
5654

57-
Example with multiple source descriptions — correct (linked `schemeName`):
55+
Example with multiple source descriptions — correct (referenced `schemeName`):
5856

5957
```yaml
6058
sourceDescriptions:
@@ -93,10 +91,9 @@ workflows:
9391

9492
## Related rules
9593

96-
- [sourceDescriptions-not-empty](./sourceDescriptions-not-empty.md)
97-
- [sourceDescriptions-name-unique](./sourceDescriptions-name-unique.md)
98-
- [sourceDescriptions-type](./sourceDescriptions-type.md)
94+
- [no-x-security-both-scheme-and-scheme-name](./no-x-security-both-scheme-and-scheme-name.md)
95+
- [x-security-scheme-required-values](./x-security-scheme-required-values.md)
9996

10097
## Resources
10198

102-
- Rule source: https://github.com/Redocly/redocly-cli/blob/main/packages/core/src/rules/arazzo/x-security-scheme-name-link.ts
99+
- Rule source: https://github.com/Redocly/redocly-cli/blob/main/packages/core/src/rules/respect/x-security-scheme-name-reference.ts

docs/@v2/sidebars.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,13 @@
151151
- page: rules/respect/respect-supported-versions.md
152152
- page: rules/respect/no-x-security-scheme-name-without-openapi.md
153153
- page: rules/respect/x-security-scheme-required-values.md
154+
- page: rules/respect/x-security-scheme-name-reference.md
155+
- page: rules/respect/no-x-security-both-scheme-and-scheme-name.md
154156
- page: rules/arazzo/criteria-unique.md
155157
- page: rules/arazzo/parameters-unique.md
156158
- page: rules/arazzo/requestBody-replacements-unique.md
157159
- page: rules/arazzo/sourceDescriptions-name-unique.md
158160
- page: rules/arazzo/sourceDescriptions-type.md
159-
- page: rules/arazzo/x-security-scheme-name-link.md
160-
- page: rules/arazzo/no-x-security-both-scheme-and-scheme-name.md
161161
- page: rules/arazzo/stepId-unique.md
162162
- page: rules/arazzo/step-onFailure-unique.md
163163
- page: rules/arazzo/step-onSuccess-unique.md

packages/core/src/config/__tests__/__snapshots__/config-resolvers.test.ts.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ exports[`resolveConfig > should ignore minimal from the root and read local file
1010
"no-enum-type-mismatch": "error",
1111
"no-required-schema-properties-undefined": "warn",
1212
"no-schema-type-mismatch": "error",
13-
"no-x-security-both-scheme-and-scheme-name": "error",
13+
"no-x-security-both-scheme-and-scheme-name": "off",
1414
"no-x-security-scheme-name-without-openapi": "off",
1515
"parameters-unique": "error",
1616
"requestBody-replacements-unique": "warn",
@@ -23,7 +23,7 @@ exports[`resolveConfig > should ignore minimal from the root and read local file
2323
"stepId-unique": "error",
2424
"workflow-dependsOn": "error",
2525
"workflowId-unique": "error",
26-
"x-security-scheme-name-link": "error",
26+
"x-security-scheme-name-reference": "off",
2727
"x-security-scheme-required-values": "off",
2828
},
2929
"async2Decorators": {},
@@ -381,7 +381,7 @@ exports[`resolveConfig > should resolve extends with local file config which con
381381
"no-enum-type-mismatch": "error",
382382
"no-required-schema-properties-undefined": "warn",
383383
"no-schema-type-mismatch": "error",
384-
"no-x-security-both-scheme-and-scheme-name": "error",
384+
"no-x-security-both-scheme-and-scheme-name": "off",
385385
"no-x-security-scheme-name-without-openapi": "off",
386386
"parameters-unique": "error",
387387
"requestBody-replacements-unique": "warn",
@@ -394,7 +394,7 @@ exports[`resolveConfig > should resolve extends with local file config which con
394394
"stepId-unique": "error",
395395
"workflow-dependsOn": "error",
396396
"workflowId-unique": "error",
397-
"x-security-scheme-name-link": "error",
397+
"x-security-scheme-name-reference": "off",
398398
"x-security-scheme-required-values": "off",
399399
},
400400
"async2Decorators": {},

packages/core/src/config/__tests__/load.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ describe('loadConfig', () => {
144144
"stepId-unique": "error",
145145
"workflow-dependsOn": "off",
146146
"workflowId-unique": "error",
147-
"x-security-scheme-name-link": "off",
147+
"x-security-scheme-name-reference": "off",
148148
"x-security-scheme-required-values": "off",
149149
},
150150
"async2Decorators": {},
@@ -439,7 +439,7 @@ describe('loadConfig', () => {
439439
"no-enum-type-mismatch": "error",
440440
"no-required-schema-properties-undefined": "warn",
441441
"no-schema-type-mismatch": "error",
442-
"no-x-security-both-scheme-and-scheme-name": "error",
442+
"no-x-security-both-scheme-and-scheme-name": "off",
443443
"no-x-security-scheme-name-without-openapi": "off",
444444
"parameters-unique": "error",
445445
"requestBody-replacements-unique": "warn",
@@ -452,7 +452,7 @@ describe('loadConfig', () => {
452452
"stepId-unique": "error",
453453
"workflow-dependsOn": "error",
454454
"workflowId-unique": "error",
455-
"x-security-scheme-name-link": "error",
455+
"x-security-scheme-name-reference": "off",
456456
"x-security-scheme-required-values": "off",
457457
},
458458
"async2Decorators": {},
@@ -765,7 +765,7 @@ describe('loadConfig', () => {
765765
"stepId-unique": "error",
766766
"workflow-dependsOn": "off",
767767
"workflowId-unique": "error",
768-
"x-security-scheme-name-link": "off",
768+
"x-security-scheme-name-reference": "off",
769769
"x-security-scheme-required-values": "off",
770770
},
771771
"async2Decorators": {},

packages/core/src/config/all.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,8 @@ const all: RawGovernanceConfig<'built-in'> = {
292292
'no-required-schema-properties-undefined': 'error',
293293
'no-enum-type-mismatch': 'error',
294294
'no-schema-type-mismatch': 'error',
295-
'x-security-scheme-name-link': 'error',
296-
'no-x-security-both-scheme-and-scheme-name': 'error',
295+
'x-security-scheme-name-reference': 'off',
296+
'no-x-security-both-scheme-and-scheme-name': 'off',
297297
},
298298
overlay1Rules: {
299299
'info-contact': 'error',

packages/core/src/rules/arazzo/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ import { NoCriteriaXpath } from '../respect/no-criteria-xpath.js';
1515
import { CriteriaUnique } from './criteria-unique.js';
1616
import { NoXSecuritySchemeNameWithoutOpenAPI } from '../respect/no-x-security-scheme-name-without-openapi.js';
1717
import { XSecuritySchemaRequiredValues } from '../respect/x-security-scheme-required-values.js';
18-
import { XSecuritySchemeNameLink } from './x-security-scheme-name-link.js';
19-
import { NoXSecurityBothSchemeAndSchemeName } from './no-x-security-both-scheme-and-scheme-name.js';
2018
import { NoUnresolvedRefs } from '../common/no-unresolved-refs.js';
2119
import { NoRequiredSchemaPropertiesUndefined } from '../common/no-required-schema-properties-undefined.js';
2220
import { NoEnumTypeMismatch } from '../common/no-enum-type-mismatch.js';
2321
import { NoSchemaTypeMismatch } from '../common/no-schema-type-mismatch.js';
22+
import { NoXSecurityBothSchemeAndSchemeName } from '../respect/no-x-security-both-scheme-and-scheme-name.js';
23+
import { XSecuritySchemeNameReference } from '../respect/x-security-scheme-name-reference.js';
2424

2525
import type { Arazzo1Rule } from '../../visitors.js';
2626
import type { Arazzo1RuleSet } from '../../oas-types.js';
@@ -44,7 +44,7 @@ export const rules: Arazzo1RuleSet<'built-in'> = {
4444
'criteria-unique': CriteriaUnique,
4545
'no-x-security-scheme-name-without-openapi': NoXSecuritySchemeNameWithoutOpenAPI,
4646
'x-security-scheme-required-values': XSecuritySchemaRequiredValues,
47-
'x-security-scheme-name-link': XSecuritySchemeNameLink,
47+
'x-security-scheme-name-reference': XSecuritySchemeNameReference,
4848
'no-x-security-both-scheme-and-scheme-name': NoXSecurityBothSchemeAndSchemeName,
4949
'no-required-schema-properties-undefined': NoRequiredSchemaPropertiesUndefined as Arazzo1Rule,
5050
'no-enum-type-mismatch': NoEnumTypeMismatch as Arazzo1Rule,

0 commit comments

Comments
 (0)