@@ -17,24 +17,18 @@ describe("bundle", () => {
17
17
const pathOrUrlOrSchema = path . resolve ( "lib" , "__tests__" , "spec" , "multiple-refs.json" ) ;
18
18
const schema = ( await refParser . bundle ( { pathOrUrlOrSchema } ) ) as any ;
19
19
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
32
21
const firstParam = schema . paths [ "/test1/{pathId}" ] . get . parameters [ 0 ] ;
33
22
const secondParam = schema . paths [ "/test2/{pathId}" ] . get . parameters [ 0 ] ;
34
23
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 ( {
38
32
name : "pathId" ,
39
33
in : "path" ,
40
34
required : true ,
0 commit comments