@@ -365,17 +365,20 @@ async function patchInstance(args: {
365365 return pollRes ;
366366}
367367
368- function populateResourceProperties ( spec : ExtensionSpec ) : void {
368+ function populateSpec ( spec : ExtensionSpec ) : void {
369369 if ( spec ) {
370- spec . resources . forEach ( ( r ) => {
370+ for ( const r of spec . resources ) {
371371 try {
372372 if ( r . propertiesYaml ) {
373373 r . properties = yaml . safeLoad ( r . propertiesYaml ) ;
374374 }
375375 } catch ( err : any ) {
376376 logger . debug ( `[ext] failed to parse resource properties yaml: ${ err } ` ) ;
377377 }
378- } ) ;
378+ }
379+ // We need to populate empty repeated fields with empty arrays, since proto wire format removes them.
380+ spec . params = spec . params ?? [ ] ;
381+ spec . systemParams = spec . systemParams ?? [ ] ;
379382 }
380383}
381384
@@ -405,7 +408,7 @@ export async function createSource(
405408 masterTimeout : 600000 ,
406409 } ) ;
407410 if ( pollRes . spec ) {
408- populateResourceProperties ( pollRes . spec ) ;
411+ populateSpec ( pollRes . spec ) ;
409412 }
410413 return pollRes ;
411414}
@@ -418,7 +421,7 @@ export async function createSource(
418421export async function getSource ( sourceName : string ) : Promise < ExtensionSource > {
419422 const res = await apiClient . get < ExtensionSource > ( `/${ sourceName } ` ) ;
420423 if ( res . body . spec ) {
421- populateResourceProperties ( res . body . spec ) ;
424+ populateSpec ( res . body . spec ) ;
422425 }
423426 return res . body ;
424427}
@@ -434,7 +437,7 @@ export async function getExtensionVersion(extensionVersionRef: string): Promise<
434437 try {
435438 const res = await apiClient . get < ExtensionVersion > ( `/${ refs . toExtensionVersionName ( ref ) } ` ) ;
436439 if ( res . body . spec ) {
437- populateResourceProperties ( res . body . spec ) ;
440+ populateSpec ( res . body . spec ) ;
438441 }
439442 return res . body ;
440443 } catch ( err : any ) {
0 commit comments