@@ -608,105 +608,6 @@ describe("useConnection", () => {
608608 required : [ "name" ] ,
609609 } ) ;
610610 } ) ;
611- test ( "resolves nested $ref references within $defs definitions" , async ( ) => {
612- const mockProtocolOnMessage = jest . fn ( ) ;
613-
614- mockSSETransport . onmessage = mockProtocolOnMessage ;
615-
616- const { result } = renderHook ( ( ) => useConnection ( defaultProps ) ) ;
617-
618- await act ( async ( ) => {
619- await result . current . connect ( ) ;
620- } ) ;
621-
622- // This mirrors the pattern from FastMCP where a definition references another definition
623- const mockRequestWithNestedDefs : JSONRPCMessage = {
624- jsonrpc : "2.0" ,
625- id : 1 ,
626- method : "elicitation/create" ,
627- params : {
628- message : "Please provide your information" ,
629- requestedSchema : {
630- type : "object" ,
631- properties : {
632- person : {
633- $ref : "#/$defs/PersonWithAddress" ,
634- } ,
635- } ,
636- $defs : {
637- PersonWithAddress : {
638- type : "object" ,
639- properties : {
640- name : {
641- type : "string" ,
642- title : "Name" ,
643- } ,
644- address : {
645- $ref : "#/$defs/Address" , // ← Nested ref: definition references another definition
646- } ,
647- } ,
648- required : [ "name" , "address" ] ,
649- } ,
650- Address : {
651- type : "object" ,
652- properties : {
653- street : {
654- type : "string" ,
655- title : "Street" ,
656- } ,
657- city : {
658- type : "string" ,
659- title : "City" ,
660- } ,
661- zipcode : {
662- type : "string" ,
663- title : "Zipcode" ,
664- } ,
665- } ,
666- required : [ "street" , "city" , "zipcode" ] ,
667- } ,
668- } ,
669- } ,
670- } ,
671- } ;
672-
673- await act ( async ( ) => {
674- mockSSETransport . onmessage ! ( mockRequestWithNestedDefs ) ;
675- } ) ;
676-
677- expect ( mockProtocolOnMessage ) . toHaveBeenCalledTimes ( 1 ) ;
678-
679- const message = mockProtocolOnMessage . mock . calls [ 0 ] [ 0 ] ;
680- // The $ref should be resolved, and nested refs within $defs should also be resolved
681- expect ( message . params . requestedSchema . properties . person ) . toEqual ( {
682- type : "object" ,
683- properties : {
684- name : {
685- type : "string" ,
686- title : "Name" ,
687- } ,
688- address : {
689- type : "object" ,
690- properties : {
691- street : {
692- type : "string" ,
693- title : "Street" ,
694- } ,
695- city : {
696- type : "string" ,
697- title : "City" ,
698- } ,
699- zipcode : {
700- type : "string" ,
701- title : "Zipcode" ,
702- } ,
703- } ,
704- required : [ "street" , "city" , "zipcode" ] ,
705- } ,
706- } ,
707- required : [ "name" , "address" ] ,
708- } ) ;
709- } ) ;
710611 } ) ;
711612
712613 describe ( "URL Port Handling" , ( ) => {
0 commit comments