@@ -17,24 +17,18 @@ describe("bundle", () => {
1717 const pathOrUrlOrSchema = path . resolve ( "lib" , "__tests__" , "spec" , "multiple-refs.json" ) ;
1818 const schema = ( await refParser . bundle ( { pathOrUrlOrSchema } ) ) as any ;
1919
20- // First reference should be fully resolved (no $ref)
21- expect ( schema . paths [ "/test1/{pathId}" ] . get . parameters [ 0 ] . name ) . toBe ( "pathId" ) ;
22- expect ( schema . paths [ "/test1/{pathId}" ] . get . parameters [ 0 ] . schema . type ) . toBe ( "string" ) ;
23- expect ( schema . paths [ "/test1/{pathId}" ] . get . parameters [ 0 ] . schema . format ) . toBe ( "uuid" ) ;
24- expect ( schema . paths [ "/test1/{pathId}" ] . get . parameters [ 0 ] . $ref ) . toBeUndefined ( ) ;
25-
26- // Second reference should be remapped to point to the first reference
27- expect ( schema . paths [ "/test2/{pathId}" ] . get . parameters [ 0 ] . $ref ) . toBe (
28- "#/paths/~1test1~1%7BpathId%7D/get/parameters/0" ,
29- ) ;
30-
31- // Both should effectively resolve to the same data
20+ // Both parameters should now be $ref to the same internal definition
3221 const firstParam = schema . paths [ "/test1/{pathId}" ] . get . parameters [ 0 ] ;
3322 const secondParam = schema . paths [ "/test2/{pathId}" ] . get . parameters [ 0 ] ;
3423
35- // The second parameter should resolve to the same data as the first
36- expect ( secondParam . $ref ) . toBeDefined ( ) ;
37- expect ( firstParam ) . toEqual ( {
24+ // The $ref should match the output structure in file_context_0
25+ expect ( firstParam . $ref ) . toBe ( "#/components/parameters/path-parameter_pathId" ) ;
26+ expect ( secondParam . $ref ) . toBe ( "#/components/parameters/path-parameter_pathId" ) ;
27+
28+ // The referenced parameter should exist and match the expected structure
29+ expect ( schema . components ) . toBeDefined ( ) ;
30+ expect ( schema . components . parameters ) . toBeDefined ( ) ;
31+ expect ( schema . components . parameters [ "path-parameter_pathId" ] ) . toEqual ( {
3832 name : "pathId" ,
3933 in : "path" ,
4034 required : true ,
0 commit comments