@@ -74,20 +74,6 @@ import { encodingParamsCalculator } from './openapi3.description.encoding'
7474const documentAnnotationRule : CompareRules = { $ : allAnnotation }
7575const operationAnnotationRule : CompareRules = { $ : allAnnotation }
7676
77- const openApiExtensionRulesFunction : ( fallbackRules : CompareRules | ( ( ) => CompareRules ) ) => CompareRules = ( fallbackRules ) => ( {
78- '/*' : ( ctx ) => {
79- const { key } = ctx
80- return typeof key === 'string' && key . startsWith ( 'x-' )
81- ? {
82- $ : allUnclassified ,
83- '/**' : {
84- $ : allUnclassified ,
85- } ,
86- }
87- : typeof fallbackRules === 'function' ? fallbackRules ( ) : fallbackRules
88- } ,
89- } )
90-
9177export const openApi3Rules = ( options : OpenApi3RulesOptions ) : CompareRules => {
9278 const requestSchemaRules = openApiSchemaRules ( options )
9379 const responseSchemaRules = openApiSchemaRules ( { ...options , response : true } )
@@ -345,51 +331,6 @@ export const openApi3Rules = (options: OpenApi3RulesOptions): CompareRules => {
345331 } ,
346332 }
347333
348- const operationCompareRules :CompareRules = {
349- $ : [ nonBreaking , breaking , unclassified ] ,
350- '/*' : operationAnnotationRule ,
351- '/tags' : {
352- ...operationAnnotationRule ,
353- mapping : deepEqualsUniqueItemsArrayMappingResolver ,
354- '/*' : {
355- ...operationAnnotationRule ,
356- [ IGNORE_DIFFERENCE_IN_KEYS_RULE ] : true ,
357- } ,
358- } ,
359- '/parameters' : {
360- ...parametersRules ,
361- $ : [ nonBreaking , apihubParametersRemovalClassifyRule , breaking ] ,
362- mapping : paramMappingResolver ( 2 ) ,
363- } ,
364- '/requestBody' : requestBodiesRules ,
365- '/callbacks' : {
366- '/*' : {
367- //no support?
368- } ,
369- } ,
370- '/responses' : responsesRules ,
371- '/deprecated' : { $ : allDeprecated } ,
372- '/security' : {
373- $ : operationSecurityClassifyRule ,
374- '/*' : {
375- $ : operationSecurityItemClassifyRule ,
376- '/*' : {
377- $ : allBreaking ,
378- mapping : deepEqualsUniqueItemsArrayMappingResolver ,
379- '/*' : {
380- $ : [ breaking , nonBreaking , breaking ] ,
381- ignoreKeyDifference : true ,
382- } ,
383- } ,
384- } ,
385- } ,
386- '/servers' : serversRules ,
387- '/externalDocs' : {
388- $ : allAnnotation ,
389- '/*' : { $ : allAnnotation } ,
390- } ,
391- }
392-
393334 return {
394335 '/openapi' : documentAnnotationRule ,
395336 '/info' : {
@@ -405,7 +346,50 @@ export const openApi3Rules = (options: OpenApi3RulesOptions): CompareRules => {
405346 mapping : options . mode === COMPARE_MODE_OPERATION ? singleOperationPathMappingResolver : pathMappingResolver ,
406347 '/summary' : { $ : allAnnotation } ,
407348 '/description' : { $ : allAnnotation } ,
408- ...openApiExtensionRulesFunction ( operationCompareRules ) ,
349+ '/*' : {
350+ $ : [ nonBreaking , breaking , unclassified ] ,
351+ '/*' : operationAnnotationRule ,
352+ '/tags' : {
353+ ...operationAnnotationRule ,
354+ mapping : deepEqualsUniqueItemsArrayMappingResolver ,
355+ '/*' : {
356+ ...operationAnnotationRule ,
357+ [ IGNORE_DIFFERENCE_IN_KEYS_RULE ] : true ,
358+ } ,
359+ } ,
360+ '/parameters' : {
361+ ...parametersRules ,
362+ $ : [ nonBreaking , apihubParametersRemovalClassifyRule , breaking ] ,
363+ mapping : paramMappingResolver ( 2 ) ,
364+ } ,
365+ '/requestBody' : requestBodiesRules ,
366+ '/callbacks' : {
367+ '/*' : {
368+ //no support?
369+ } ,
370+ } ,
371+ '/responses' : responsesRules ,
372+ '/deprecated' : { $ : allDeprecated } ,
373+ '/security' : {
374+ $ : operationSecurityClassifyRule ,
375+ '/*' : {
376+ $ : operationSecurityItemClassifyRule ,
377+ '/*' : {
378+ $ : allBreaking ,
379+ mapping : deepEqualsUniqueItemsArrayMappingResolver ,
380+ '/*' : {
381+ $ : [ breaking , nonBreaking , breaking ] ,
382+ ignoreKeyDifference : true ,
383+ } ,
384+ } ,
385+ } ,
386+ } ,
387+ '/servers' : serversRules ,
388+ '/externalDocs' : {
389+ $ : allAnnotation ,
390+ '/*' : { $ : allAnnotation } ,
391+ } ,
392+ } ,
409393 '/servers' : serversRules ,
410394 '/parameters' : {
411395 ...parametersRules ,
0 commit comments