Skip to content

Commit adafe65

Browse files
committed
feat: updated pathItem rules
1 parent 71a64ab commit adafe65

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

src/openapi/openapi3.rules.ts

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,20 @@ export const openApi3Rules = (options: OpenApi3RulesOptions): CompareRules => {
388388
'/*': operationAnnotationRule,
389389
}
390390

391+
const pathItemChildrenRules = (options: OpenApi3RulesOptions): CompareRules => ({
392+
$: pathChangeClassifyRule,
393+
mapping: options.mode === COMPARE_MODE_OPERATION ? singleOperationPathMappingResolver : pathMappingResolver,
394+
'/description': { $: allAnnotation },
395+
'/parameters': {
396+
$: [nonBreaking, breaking, breaking],
397+
mapping: paramMappingResolver(1),
398+
...parametersRules,
399+
},
400+
'/servers': serversRules,
401+
'/summary': { $: allAnnotation },
402+
'/*': operationRule,
403+
})
404+
391405
const componentsRule: CompareRules = {
392406
$: allNonBreaking,
393407
[START_NEW_COMPARE_SCOPE_RULE]: COMPARE_SCOPE_COMPONENTS,
@@ -414,10 +428,7 @@ export const openApi3Rules = (options: OpenApi3RulesOptions): CompareRules => {
414428
},
415429
'/pathItems': {
416430
$: [nonBreaking, breaking, breaking],
417-
'/*': {
418-
$: [nonBreaking, breaking, breaking],
419-
'/*': operationRule
420-
},
431+
'/*': pathItemChildrenRules(options),
421432
},
422433
'/securitySchemes': {
423434
$: [breaking, nonBreaking, breaking],
@@ -445,19 +456,7 @@ export const openApi3Rules = (options: OpenApi3RulesOptions): CompareRules => {
445456
'/paths': {
446457
$: allUnclassified,
447458
mapping: options.mode === COMPARE_MODE_OPERATION ? singleOperationPathMappingResolver : pathMappingResolver,
448-
'/*': {
449-
$: pathChangeClassifyRule,
450-
mapping: options.mode === COMPARE_MODE_OPERATION ? singleOperationPathMappingResolver : pathMappingResolver,
451-
'/description': { $: allAnnotation },
452-
'/parameters': {
453-
$: [nonBreaking, breaking, breaking],
454-
mapping: paramMappingResolver(1),
455-
...parametersRules,
456-
},
457-
'/servers': serversRules,
458-
'/summary': { $: allAnnotation },
459-
'/*': operationRule,
460-
},
459+
'/*': pathItemChildrenRules(options),
461460
},
462461
'/components': componentsRule,
463462
'/security': {

0 commit comments

Comments
 (0)