@@ -13,7 +13,7 @@ class GRPCAutoInputForm extends Component {
1313 this . setService = this . setService . bind ( this ) ;
1414 this . setRequest = this . setRequest . bind ( this ) ;
1515 }
16- // event handler on the arrow button that allows you to open/close the section
16+ // event handler on the arrow button that allows you to open/close the section
1717 toggleShow ( ) {
1818 this . setState ( {
1919 show : ! this . state . show
@@ -86,9 +86,9 @@ class GRPCAutoInputForm extends Component {
8686 let streamingType ;
8787 let packageName ;
8888 /*
89- for each service obj in the services array, if its name matches the current selected service option then:
89+ for each service obj in the services array, if its name matches the current selected service option then:
9090 - save the package name
91- - iterate through the rpcs and if its name matches the current selected request then save its streaming type
91+ - iterate through the rpcs and if its name matches the current selected request then save its streaming type
9292 */
9393 for ( const service of services ) {
9494 if ( service . name === selectedService ) {
@@ -112,7 +112,7 @@ class GRPCAutoInputForm extends Component {
112112 let req ;
113113 let results = [ ] ;
114114 let query = '' ;
115- /*
115+ /*
116116 for each service obj in the services array, if its name matches the current selected service option then:
117117 - iterate through the rpcs and if its name matches the current selected request then save the name of req/rpc
118118 - iterate through the messages and if its name matches the saved req/rpc name,
@@ -126,15 +126,41 @@ class GRPCAutoInputForm extends Component {
126126 }
127127 }
128128 for ( const message of service . messages ) {
129+ // console.log('message: ', message);
129130 if ( message . name === req ) {
130131 for ( const key in message . def ) {
132+ // if message type is a nested message (message.def.nested === true)
133+ // message.def = key: {dependent: dependent.message.def}
134+ // console.log('message.def.nested: ', message.def[key].nested);
135+ // console.log('key: ', key);
136+ if ( message . def [ key ] . nested ) {
137+ for ( const submess of service . messages ) {
138+ // console.log('submess: ', submess);
139+ // console.log('submess.name: ', submess.name);
140+ // console.log('message.def[key].dependent: ', message.def[key].dependent);
141+ if ( submess . name === message . def [ key ] . dependent ) {
142+ // define obj for the submessage definition
143+ let tempObj = { } ;
144+ for ( const subKey in submess . def ) {
145+ tempObj [ subKey ] = submess . def [ subKey ] . type . slice ( 5 ) . toLowerCase ( )
146+ }
147+ // console.log('tempObj: ', tempObj);
148+ results . push ( `"${ key } ":${ JSON . stringify ( tempObj ) } ` )
149+ break ;
150+ }
151+ // break;
152+ } //after
153+ } else {
154+ // console.log('message.def: ', message.def);
131155 results . push ( `"${ key } ": "${ message . def [ key ] . type . slice ( 5 ) . toLowerCase ( ) } "` )
132156 }
133- break ;
134157 }
135- }
158+ break ;
136159 }
137160 }
161+ }
162+ }
163+
138164 const streamsArr = this . props . newRequestStreams . streamsArr ;
139165 const streamContent = this . props . newRequestStreams . streamContent ;
140166 // query for messages with single key:value pair
@@ -149,7 +175,7 @@ class GRPCAutoInputForm extends Component {
149175 }
150176 query = query . slice ( 1 ) . trim ( ) ;
151177 }
152- // set query in streamsArr
178+ // set query in streamsArr
153179 if ( streamsArr [ 0 ] !== '' ) {
154180 streamsArr [ 0 ] . query = `{
155181 ${ query }
0 commit comments