@@ -206,7 +206,13 @@ export function getFileDetailsSchema(
206206 stringSchema : StringSchema ,
207207 processSchemaFunc : ( type : SdkType ) => Schema ,
208208) : ObjectSchema {
209+ let fileSdkType : SdkModelType | undefined ;
209210 if ( property . type . kind === "model" ) {
211+ fileSdkType = property . type ;
212+ } else if ( property . type . kind === "array" && property . type . valueType . kind === "model" ) {
213+ fileSdkType = property . type . valueType ;
214+ }
215+ if ( fileSdkType ) {
210216 // property.type is File, use name and properties from property.type for the File schema
211217 /*
212218 Current logic:
@@ -218,39 +224,37 @@ export function getFileDetailsSchema(
218224 - Allow required for "filename" and "contentType"
219225 */
220226 const filePropertyName = property . name ;
221- const fileSchemaName = property . type . name ;
227+ const fileSchemaName = fileSdkType . name ;
222228 const schemaName = getFileSchemaName ( fileSchemaName ) ;
223229 let fileDetailsSchema = fileDetailsMap . get ( schemaName ) ;
224230 if ( ! fileDetailsSchema ) {
225231 const typeNamespace = getNamespace ( property . type . __raw ) ?? namespace ;
226232 fileDetailsSchema = createFileDetailsSchema ( schemaName , filePropertyName , typeNamespace , schemas ) ;
227233
228234 // description if available
229- if ( property . type . description ) {
230- fileDetailsSchema . summary = property . type . description ;
235+ if ( fileSdkType . description ) {
236+ fileDetailsSchema . summary = fileSdkType . description ;
231237 }
232- if ( property . type . details ) {
233- fileDetailsSchema . language . default . description = property . type . details ;
238+ if ( fileSdkType . details ) {
239+ fileDetailsSchema . language . default . description = fileSdkType . details ;
234240 }
235241 // crossLanguageDefinitionId
236- ( fileDetailsSchema as CrossLanguageDefinition ) . crossLanguageDefinitionId =
237- property . type . crossLanguageDefinitionId ;
242+ ( fileDetailsSchema as CrossLanguageDefinition ) . crossLanguageDefinitionId = fileSdkType . crossLanguageDefinitionId ;
238243
239244 let contentTypeProperty ;
240245 let filenameProperty ;
241246
242247 // find "filename" and "contentType" property in current model and its base models
243- let type : SdkModelType | undefined = property . type ;
244- while ( type !== undefined ) {
245- for ( const property of type . properties ) {
248+ while ( fileSdkType !== undefined ) {
249+ for ( const property of fileSdkType . properties ) {
246250 if ( ! filenameProperty && property . name === "filename" ) {
247251 filenameProperty = property ;
248252 }
249253 if ( ! contentTypeProperty && property . name === "contentType" ) {
250254 contentTypeProperty = property ;
251255 }
252256 }
253- type = type . baseModel ;
257+ fileSdkType = fileSdkType . baseModel ;
254258 }
255259
256260 addContentProperty ( fileDetailsSchema , binarySchema ) ;
0 commit comments