@@ -386,7 +386,69 @@ describe("Next link operations", () => {
386386 const [ root ] = createModel ( sdkContext ) ;
387387
388388 // Two enums share the name "Status" but live in different namespaces.
389- // The namespace-aware dedup key must keep both in the code model.
389+ // The namespace-aware key must keep both in the code model.
390+ const statusEnums = root . enums . filter ( ( e ) => e . name === "Status" ) ;
391+ strictEqual (
392+ statusEnums . length ,
393+ 2 ,
394+ `Expected 2 'Status' enums from different namespaces. Found ${ statusEnums . length } : ${ root . enums . map ( ( e ) => `${ e . namespace } .${ e . name } ` ) . join ( ", " ) } ` ,
395+ ) ;
396+ } ) ;
397+
398+ it ( "preserves same-named models from different namespaces across two paging operations" , async ( ) => {
399+ const program = await typeSpecCompile (
400+ `
401+ namespace NsA {
402+ enum Status { active, inactive };
403+ model Item {
404+ name: string;
405+ status: Status;
406+ };
407+ }
408+ namespace NsB {
409+ enum Status { open, closed };
410+ model Item {
411+ id: int32;
412+ status: Status;
413+ };
414+ }
415+
416+ @convenientAPI(false)
417+ @list
418+ @route("/a")
419+ op listA(): {
420+ @pageItems
421+ items: NsA.Item[];
422+ @nextLink
423+ next?: url;
424+ };
425+
426+ @convenientAPI(false)
427+ @list
428+ @route("/b")
429+ op listB(): {
430+ @pageItems
431+ items: NsB.Item[];
432+ @nextLink
433+ next?: url;
434+ };
435+ ` ,
436+ runner ,
437+ { IsTCGCNeeded : true } ,
438+ ) ;
439+ const context = createEmitterContext ( program ) ;
440+ const sdkContext = await createCSharpSdkContext ( context ) ;
441+ const [ root ] = createModel ( sdkContext ) ;
442+
443+ // Two paging operations reference models named "Item" and enums named
444+ // "Status" from different namespaces. All four types must be present.
445+ const itemModels = root . models . filter ( ( m ) => m . name === "Item" ) ;
446+ strictEqual (
447+ itemModels . length ,
448+ 2 ,
449+ `Expected 2 'Item' models from different namespaces. Found ${ itemModels . length } : ${ root . models . map ( ( m ) => `${ m . namespace } .${ m . name } ` ) . join ( ", " ) } ` ,
450+ ) ;
451+
390452 const statusEnums = root . enums . filter ( ( e ) => e . name === "Status" ) ;
391453 strictEqual (
392454 statusEnums . length ,
0 commit comments