@@ -550,6 +550,86 @@ describe('IntrinsicFunctionArgumentCompletionProvider - GetAtt Function', () =>
550550 expect ( labels ) . not . toContain ( 'MetadataTableConfiguration/S3TablesDestination/TableNamespace' ) ;
551551 } ) ;
552552
553+ it ( 'should use correct JSON pointer path for nested attribute schema resolution' , ( ) => {
554+ // Create a mock schema with nested attributes that have descriptions
555+ const mockSchemaWithNestedAttributes = JSON . stringify ( {
556+ typeName : 'AWS::RDS::DBInstance' ,
557+ description : 'Mock RDS DBInstance schema' ,
558+ additionalProperties : false ,
559+ primaryIdentifier : [ '/properties/DBInstanceIdentifier' ] ,
560+ properties : {
561+ Endpoint : {
562+ type : 'object' ,
563+ properties : {
564+ Address : {
565+ type : 'string' ,
566+ description : 'The connection endpoint for the database instance' ,
567+ } ,
568+ Port : {
569+ type : 'string' ,
570+ description : 'The port number on which the database accepts connections' ,
571+ } ,
572+ } ,
573+ } ,
574+ } ,
575+ readOnlyProperties : [ '/properties/Endpoint/Address' , '/properties/Endpoint/Port' ] ,
576+ } ) ;
577+
578+ const mockRdsSchema = new ResourceSchema ( mockSchemaWithNestedAttributes ) ;
579+
580+ // Mock the resolveJsonPointerPath method to track what paths are requested
581+ const resolveJsonPointerPathSpy = vi . spyOn ( mockRdsSchema , 'resolveJsonPointerPath' ) ;
582+ resolveJsonPointerPathSpy . mockImplementation ( ( path : string ) => {
583+ if ( path === '/properties/Endpoint/Address' ) {
584+ return [ { description : 'The connection endpoint for the database instance' } ] ;
585+ } else if ( path === '/properties/Endpoint/Port' ) {
586+ return [ { description : 'The port number on which the database accepts connections' } ] ;
587+ }
588+ return [ ] ;
589+ } ) ;
590+
591+ const mockSchemasWithRds = new Map ( [ [ 'AWS::RDS::DBInstance' , mockRdsSchema ] ] ) ;
592+ const mockCombinedSchemasWithRds = new CombinedSchemas ( ) ;
593+ ( mockCombinedSchemasWithRds as any ) . schemas = mockSchemasWithRds ;
594+ const mockSchemaRetrieverWithRds = createMockSchemaRetriever ( mockCombinedSchemasWithRds ) ;
595+
596+ provider = new IntrinsicFunctionArgumentCompletionProvider (
597+ mockSyntaxTreeManager ,
598+ mockSchemaRetrieverWithRds ,
599+ mockDocumentManager ,
600+ ) ;
601+
602+ setupResourceEntitiesWithSchema ( { DatabaseInstance : { Type : 'AWS::RDS::DBInstance' } } ) ;
603+ const mockContext = createMockGetAttContext ( '' , 'DatabaseInstance.' ) ;
604+
605+ const result = provider . getCompletions ( mockContext , createTestParams ( ) ) ;
606+
607+ expect ( result ) . toBeDefined ( ) ;
608+ expect ( result ! . length ) . toBe ( 2 ) ;
609+
610+ expect ( resolveJsonPointerPathSpy ) . toHaveBeenCalledWith ( '/properties/Endpoint/Address' ) ;
611+ expect ( resolveJsonPointerPathSpy ) . toHaveBeenCalledWith ( '/properties/Endpoint/Port' ) ;
612+
613+ expect ( resolveJsonPointerPathSpy ) . not . toHaveBeenCalledWith ( '/properties/Endpoint/properties/Address' ) ;
614+ expect ( resolveJsonPointerPathSpy ) . not . toHaveBeenCalledWith ( '/properties/Endpoint/properties/Port' ) ;
615+
616+ const labels = result ! . map ( ( item ) => item . label ) ;
617+ expect ( labels ) . toContain ( 'Endpoint.Address' ) ;
618+ expect ( labels ) . toContain ( 'Endpoint.Port' ) ;
619+
620+ const addressItem = result ! . find ( ( item ) => item . label === 'Endpoint.Address' ) ;
621+ const portItem = result ! . find ( ( item ) => item . label === 'Endpoint.Port' ) ;
622+
623+ expect ( addressItem ) . toBeDefined ( ) ;
624+ expect ( portItem ) . toBeDefined ( ) ;
625+
626+ // Check that documentation was set
627+ expect ( addressItem ! . documentation ) . toBeDefined ( ) ;
628+ expect ( portItem ! . documentation ) . toBeDefined ( ) ;
629+
630+ resolveJsonPointerPathSpy . mockRestore ( ) ;
631+ } ) ;
632+
553633 it ( 'should remove duplicate attribute names' , ( ) => {
554634 // Setup mock schema with duplicates
555635 const duplicateSchemaJson = JSON . stringify ( {
0 commit comments