Skip to content

Commit c43f275

Browse files
committed
fix: remove special handling for operation parameter style attribute
it is redundant since default values for style are now supported in api-unifier
1 parent 849c20e commit c43f275

File tree

3 files changed

+3
-23
lines changed

3 files changed

+3
-23
lines changed

src/openapi/openapi3.classify.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
unclassified,
1212
} from '../core'
1313
import { getKeyValue, isExist, isNotEmptyArray } from '../utils'
14-
import { emptySecurity, getDefaultStyle, includeSecurity } from './openapi3.utils'
14+
import { emptySecurity, includeSecurity } from './openapi3.utils'
1515
import type { ClassifyRule, CompareContext } from '../types'
1616
import { DiffType } from '../types'
1717
import { hidePathParamNames } from './openapi3.mapping'
@@ -47,12 +47,6 @@ export const apihubParametersRemovalClassifyRule = (ctx: CompareContext): DiffTy
4747
: breaking
4848
}
4949

50-
export const parameterStyleClassifyRule: ClassifyRule = [
51-
({ after }) => (after.value === getDefaultStyle(getKeyValue(after.parent, 'in')) ? nonBreaking : breaking),
52-
({ before }) => (before.value === getDefaultStyle(getKeyValue(before.parent, 'in')) ? nonBreaking : breaking),
53-
breaking,
54-
]
55-
5650
export const parameterExplodeClassifyRule: ClassifyRule = [
5751
({ after }) => ((after.value && getKeyValue(after.parent, 'style') === 'form') || (!after.value && getKeyValue(after.parent, 'style') !== 'form') ? annotation : breaking),
5852
({ before }) => ((before.value && getKeyValue(before.parent, 'style') === 'form') || (!before.value && getKeyValue(before.parent, 'style') !== 'form') ? annotation : breaking),

src/openapi/openapi3.rules.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ import {
4949
parameterAllowReservedClassifyRule,
5050
parameterExplodeClassifyRule,
5151
parameterNameClassifyRule,
52-
parameterRequiredClassifyRule,
53-
parameterStyleClassifyRule,
52+
parameterRequiredClassifyRule,
5453
pathChangeClassifyRule,
5554
} from './openapi3.classify'
5655
import {
@@ -157,7 +156,7 @@ export const openApi3Rules = (options: OpenApi3RulesOptions): CompareRules => {
157156
description: diffDescription(resolveParameterDescriptionTemplates('deprecated status'))
158157
},
159158
'/style': {
160-
$: parameterStyleClassifyRule,
159+
$: allBreaking,
161160
description: diffDescription(resolveParameterDescriptionTemplates('delimited style'))
162161
},
163162
'/explode': {

src/openapi/openapi3.utils.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,6 @@ export const mapPathParams = (ctx: CompareContext, jumpsToPathLevel: number): Re
5757
return result
5858
}
5959

60-
export const getDefaultStyle = (type: unknown) => {
61-
switch (type) {
62-
case 'query':
63-
return 'form'
64-
case 'cookie':
65-
return 'form'
66-
case 'path':
67-
return 'simple'
68-
case 'header':
69-
return 'simple'
70-
}
71-
}
72-
7360
export const isResponseSchema = (path: JsonPath) => {
7461
return path[3] === 'responses' && path[7] === 'schema'
7562
}

0 commit comments

Comments
 (0)