Skip to content

Commit f38895a

Browse files
committed
feat: Cleaning
1 parent 66af9d8 commit f38895a

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/apitypes/rest/rest.operation.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,11 @@ export const calculateSpecRefs = (
247247
})
248248

249249
if (operations?.length) {
250-
createSinglePathItemOperationSpec(resultSpec, normalizedSpec, operations)
250+
resolveComponentsPathItemOperationSpec(resultSpec, normalizedSpec, operations)
251251
}
252252
}
253253

254-
export function createSinglePathItemOperationSpec(
254+
export function resolveComponentsPathItemOperationSpec(
255255
sourceDocument: RestOperationData,
256256
normalizedDocument: RestOperationData,
257257
operations: OperationId[],
@@ -267,11 +267,12 @@ export function createSinglePathItemOperationSpec(
267267
if (refs.length === 0) {
268268
continue
269269
}
270-
const richReference = parseRef(refs[0])
271-
if (!richReference) {
270+
const { jsonPath } = parseRef(refs[0])
271+
if (!jsonPath) {
272272
continue
273273
}
274-
const valueByPath = getValueByPath(sourceDocument, richReference.jsonPath) as OpenAPIV3.PathItemObject
274+
275+
const valueByPath = getValueByPath(sourceDocument, jsonPath) as OpenAPIV3.PathItemObject
275276

276277
const operationIds: OpenAPIV3.HttpMethods[] = (Object.keys(valueByPath) as OpenAPIV3.HttpMethods[])
277278
.filter((httpMethod) => isValidHttpMethod(httpMethod))
@@ -298,7 +299,7 @@ export function createSinglePathItemOperationSpec(
298299
return pathItemObject
299300
}, {}),
300301
}
301-
setValueByPath(sourceDocument, richReference.jsonPath, pathItemObject)
302+
setValueByPath(sourceDocument, jsonPath, pathItemObject)
302303
}
303304
}
304305
}

0 commit comments

Comments
 (0)