File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,24 @@ export const singleOperationPathMappingResolver: MappingResolver<string> = (befo
3232 return result
3333}
3434
35+ /**
36+ * Maps OpenAPI path keys between two versions of the spec by considering possible base path changes
37+ * defined in the root object `servers` field and path item object `servers` field.
38+ * This mapping normalizes (unifies) paths by removing any basePath prefixes
39+ * so that equivalent endpoints are recognized and correctly mapped even if the base path (URL prefix)
40+ * has changed. It does *not* handle server base paths defined at the operation level.
41+ * It also maps paths even if path parameters have changed.
42+ *
43+ * @param before - The "before" object representing a set of OpenAPI paths (mapping string keys to PathItemObject)
44+ * @param after - The "after" object representing a set of OpenAPI paths (mapping string keys to PathItemObject)
45+ * @param ctx - The NodeContext, used here to access the root OpenAPI Document for both "before" and "after"
46+ * @returns {MapKeysResult<string> } An object containing arrays of `added` and `removed` path keys, and
47+ * a mapping between old and new keys for matched paths.
48+ *
49+ * @remarks
50+ * This method does not support mapping when the base path is defined in the operation-level `servers`.
51+ * See related test: "Should match operation when prefix moved from operation object servers to path".
52+ */
3553export const pathMappingResolver : MappingResolver < string > = ( before , after , ctx ) => {
3654
3755 const result : MapKeysResult < string > = { added : [ ] , removed : [ ] , mapped : { } }
You can’t perform that action at this time.
0 commit comments