@@ -66,6 +66,18 @@ import {
6666} from './rest.utils'
6767import { createOperationChange , getOperationTags , OperationsMap } from '../../components'
6868
69+ /**
70+ * Calculates a normalized operation ID for an operation.
71+ *
72+ * @param basePath - The base path from servers configuration
73+ * @param path - The operation path
74+ * @param method - The HTTP method
75+ * @returns The normalized operation ID
76+ */
77+ function calculateNormalizedOperationId ( basePath : string , path : string , method : string ) : string {
78+ return slugify ( `${ normalizePath ( basePath + path ) } -${ method } ` , [ ] , IGNORE_PATH_PARAM_UNIFIED_PLACEHOLDER )
79+ }
80+
6981export const compareDocuments = async (
7082 operationsMap : OperationsMap ,
7183 prevDoc : ResolvedVersionDocument | undefined ,
@@ -140,8 +152,8 @@ export const compareDocuments = async (
140152 // todo if there were actually servers here, we wouldn't have handle it, add a test
141153 const previousBasePath = getOperationBasePath ( methodData ?. servers || pathData ?. servers || prevDocData . servers || [ ] )
142154 const currentBasePath = getOperationBasePath ( methodData ?. servers || pathData ?. servers || currDocData . servers || [ ] )
143- const prevNormalizedOperationId = slugify ( ` ${ normalizePath ( previousBasePath + path ) } - ${ inferredMethod } ` , [ ] , IGNORE_PATH_PARAM_UNIFIED_PLACEHOLDER )
144- const currNormalizedOperationId = slugify ( ` ${ normalizePath ( currentBasePath + path ) } - ${ inferredMethod } ` , [ ] , IGNORE_PATH_PARAM_UNIFIED_PLACEHOLDER )
155+ const prevNormalizedOperationId = calculateNormalizedOperationId ( previousBasePath , path , inferredMethod )
156+ const currNormalizedOperationId = calculateNormalizedOperationId ( currentBasePath , path , inferredMethod )
145157
146158 const { current, previous } = operationsMap [ prevNormalizedOperationId ] ?? operationsMap [ currNormalizedOperationId ] ?? { }
147159 if ( ! current && ! previous ) {
0 commit comments