mirror of
https://github.com/LukeHagar/redocly-cli.git
synced 2025-12-06 04:21:09 +00:00
fix: changes in criteria-unique arazzo rule (#1733)
This commit is contained in:
committed by
Luke Hagar
parent
9b7f50f9a9
commit
7b39fde186
6
.changeset/hungry-drinks-grab.md
Normal file
6
.changeset/hungry-drinks-grab.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
"@redocly/openapi-core": patch
|
||||||
|
"@redocly/cli": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Added additional checks to `criteria-unique` Arazzo rule.
|
||||||
@@ -74,7 +74,7 @@ export class StyleguideConfig {
|
|||||||
[SpecVersion.Async2]: { ...rawConfig.rules, ...rawConfig.async2Rules },
|
[SpecVersion.Async2]: { ...rawConfig.rules, ...rawConfig.async2Rules },
|
||||||
[SpecVersion.Async3]: { ...rawConfig.rules, ...rawConfig.async3Rules },
|
[SpecVersion.Async3]: { ...rawConfig.rules, ...rawConfig.async3Rules },
|
||||||
[SpecVersion.Arazzo]: {
|
[SpecVersion.Arazzo]: {
|
||||||
...rawConfig.arazzoRules,
|
...(rawConfig.arazzoRules || {}),
|
||||||
...(rawConfig.rules?.assertions ? { assertions: rawConfig.rules.assertions } : {}),
|
...(rawConfig.rules?.assertions ? { assertions: rawConfig.rules.assertions } : {}),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,7 +5,10 @@ export const CriteriaUnique: ArazzoRule = () => {
|
|||||||
return {
|
return {
|
||||||
FailureActionObject: {
|
FailureActionObject: {
|
||||||
enter(action, { report, location }: UserContext) {
|
enter(action, { report, location }: UserContext) {
|
||||||
const criterias = action.criteria;
|
const criterias = action?.criteria;
|
||||||
|
if (!Array.isArray(criterias)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const seen = new Set<string>();
|
const seen = new Set<string>();
|
||||||
for (const criteria of criterias) {
|
for (const criteria of criterias) {
|
||||||
const key = JSON.stringify(criteria);
|
const key = JSON.stringify(criteria);
|
||||||
@@ -22,7 +25,10 @@ export const CriteriaUnique: ArazzoRule = () => {
|
|||||||
},
|
},
|
||||||
SuccessActionObject: {
|
SuccessActionObject: {
|
||||||
enter(action, { report, location }: UserContext) {
|
enter(action, { report, location }: UserContext) {
|
||||||
const criterias = action.criteria;
|
const criterias = action?.criteria;
|
||||||
|
if (!Array.isArray(criterias)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const seen = new Set<string>();
|
const seen = new Set<string>();
|
||||||
for (const criteria of criterias) {
|
for (const criteria of criterias) {
|
||||||
const key = JSON.stringify(criteria);
|
const key = JSON.stringify(criteria);
|
||||||
@@ -39,11 +45,12 @@ export const CriteriaUnique: ArazzoRule = () => {
|
|||||||
},
|
},
|
||||||
Step: {
|
Step: {
|
||||||
enter(step, { report, location }: UserContext) {
|
enter(step, { report, location }: UserContext) {
|
||||||
if (!step.successCriteria) {
|
const successCriterias = step?.successCriteria;
|
||||||
|
|
||||||
|
if (!Array.isArray(successCriterias)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const successCriterias = step.successCriteria;
|
|
||||||
const seen = new Set<string>();
|
const seen = new Set<string>();
|
||||||
|
|
||||||
for (const criteria of successCriterias) {
|
for (const criteria of successCriterias) {
|
||||||
|
|||||||
Reference in New Issue
Block a user