@@ -79,15 +79,15 @@ const checkAllMethodsHaveSameApiKind = (obj: unknown, apiKind: string): boolean
7979
8080const ROOT_PATH_LENGTH = 0
8181const PATH_ITEM_PATH_LENGTH = 2
82- const MAX_BWC_FLAG_PATH_LENGTH = 3
82+ const OPERATION_OBJECT_PATH_LENGTH = 3
8383
84- export const checkApiKind = (
84+ export const createApiKindChecker = (
8585 prevApiKind : string = API_KIND . BWC ,
8686 currApiKind : string = API_KIND . BWC ,
8787) : ApiCompatibilityScopeFunction => {
8888 const defaultApiCompatibilityKind = ( prevApiKind === API_KIND . NO_BWC || currApiKind === API_KIND . NO_BWC )
8989 ? ApiCompatibilityKind . NOT_BACKWARD_COMPATIBLE
90- : undefined
90+ : ApiCompatibilityKind . BACKWARD_COMPATIBLE
9191
9292 return (
9393 path ?: JsonPath ,
@@ -98,7 +98,7 @@ export const checkApiKind = (
9898 /*
9999 * Calculating Api Kind for the entire document as the default
100100 * If there is a NO_BWC marker on:
101- * - Publish label
101+ * - Version labels and Document labels
102102 * - Document API info section
103103 */
104104 if ( pathLength === ROOT_PATH_LENGTH ) {
@@ -110,7 +110,7 @@ export const checkApiKind = (
110110 * Level 3: When individual operations are deleted/added
111111 */
112112 const isFirstPathSegmentPaths = path ?. [ 0 ] === 'paths'
113- if ( ! isFirstPathSegmentPaths || pathLength < PATH_ITEM_PATH_LENGTH || pathLength > MAX_BWC_FLAG_PATH_LENGTH ) {
113+ if ( ! isFirstPathSegmentPaths || pathLength < PATH_ITEM_PATH_LENGTH || pathLength > OPERATION_OBJECT_PATH_LENGTH ) {
114114 return undefined
115115 }
116116
0 commit comments