@@ -68,7 +68,7 @@ export function SMBForm(props: SMBFormProps) {
6868
6969 const payloadContext = {
7070 protocol : Protocol . SMB ,
71- filterType : functionModel ?. name . metadata . label || "JSON" ,
71+ filterType : functionModel ?. name ? .metadata ? .label || "JSON" ,
7272 } as GeneralPayloadContext ;
7373
7474 const [ isTypeEditorOpen , setIsTypeEditorOpen ] = useState < boolean > ( false ) ;
@@ -182,15 +182,16 @@ export function SMBForm(props: SMBFormProps) {
182182
183183 let baseType = typeValue ;
184184
185- if ( baseType . endsWith ( "[]" ) && baseType !== "string[]" ) {
186- baseType = baseType . slice ( 0 , - 2 ) ;
187- } else if ( baseType . startsWith ( "stream<" ) ) {
185+ if ( baseType . startsWith ( "stream<" ) ) {
188186 if ( baseType . endsWith ( ", error>" ) ) {
189187 baseType = baseType . slice ( 7 , - 8 ) ;
190188 } else if ( baseType . endsWith ( ">" ) ) {
191189 baseType = baseType . slice ( 7 , - 1 ) ;
192190 }
193191 }
192+ if ( baseType . endsWith ( "[]" ) && baseType !== "string[]" ) {
193+ baseType = baseType . slice ( 0 , - 2 ) ;
194+ }
194195
195196 return baseType ;
196197 } ;
@@ -251,6 +252,16 @@ export function SMBForm(props: SMBFormProps) {
251252 enabled : true
252253 } ;
253254 }
255+ if ( p . kind === "REQUIRED" && p . name . value === "content" ) {
256+ const resetValue = hasStreamProperty && functionModel . properties ?. stream ?. enabled
257+ ? selectType ( p . type . placeholder , functionModel . properties . stream . enabled )
258+ : p . type . placeholder ;
259+ return {
260+ ...p ,
261+ type : { ...p . type , value : resetValue } ,
262+ enabled : true
263+ } ;
264+ }
254265 return p ;
255266 } ) ;
256267
@@ -346,7 +357,10 @@ export function SMBForm(props: SMBFormProps) {
346357 if ( params . length === 0 ) {
347358 handleDeleteContentSchema ( ) ;
348359 } else {
349- handleParamChange ( params ) ;
360+ const updatedParameters = functionModel . parameters . map ( p =>
361+ p . kind === "DATA_BINDING" ? params [ 0 ] : p
362+ ) ;
363+ handleParamChange ( updatedParameters ) ;
350364 }
351365 } }
352366 onEditClick = { handleEditContentSchema }
0 commit comments