@@ -228,7 +228,7 @@ private async Task<OpenApiResponse> GetResponseAsync(ApiDescription apiDescripti
228
228
. Select ( responseFormat => responseFormat . MediaType ) ;
229
229
foreach ( var contentType in apiResponseFormatContentTypes )
230
230
{
231
- var schema = apiResponseType . Type is { } type ? await _componentService . GetOrCreateSchemaAsync ( type , null , cancellationToken ) : new OpenApiSchema ( ) ;
231
+ var schema = apiResponseType . Type is { } type ? await _componentService . GetOrCreateSchemaAsync ( type , null , captureSchemaByRef : true , cancellationToken ) : new OpenApiSchema ( ) ;
232
232
response . Content [ contentType ] = new OpenApiMediaType { Schema = schema } ;
233
233
}
234
234
@@ -269,7 +269,7 @@ private async Task<OpenApiResponse> GetResponseAsync(ApiDescription apiDescripti
269
269
_ => throw new InvalidOperationException ( $ "Unsupported parameter source: { parameter . Source . Id } ")
270
270
} ,
271
271
Required = IsRequired ( parameter ) ,
272
- Schema = await _componentService . GetOrCreateSchemaAsync ( parameter . Type , parameter , cancellationToken ) ,
272
+ Schema = await _componentService . GetOrCreateSchemaAsync ( parameter . Type , parameter , cancellationToken : cancellationToken ) ,
273
273
Description = GetParameterDescriptionFromAttribute ( parameter )
274
274
} ;
275
275
@@ -347,7 +347,7 @@ private async Task<OpenApiRequestBody> GetFormRequestBody(IList<ApiRequestFormat
347
347
if ( parameter . All ( parameter => parameter . ModelMetadata . ContainerType is null ) )
348
348
{
349
349
var description = parameter . Single ( ) ;
350
- var parameterSchema = await _componentService . GetOrCreateSchemaAsync ( description . Type , null , cancellationToken ) ;
350
+ var parameterSchema = await _componentService . GetOrCreateSchemaAsync ( description . Type , null , cancellationToken : cancellationToken ) ;
351
351
// Form files are keyed by their parameter name so we must capture the parameter name
352
352
// as a property in the schema.
353
353
if ( description . Type == typeof ( IFormFile ) || description . Type == typeof ( IFormFileCollection ) )
@@ -410,15 +410,15 @@ private async Task<OpenApiRequestBody> GetFormRequestBody(IList<ApiRequestFormat
410
410
var propertySchema = new OpenApiSchema { Type = "object" , Properties = new Dictionary < string , OpenApiSchema > ( ) } ;
411
411
foreach ( var description in parameter )
412
412
{
413
- propertySchema . Properties [ description . Name ] = await _componentService . GetOrCreateSchemaAsync ( description . Type , null , cancellationToken ) ;
413
+ propertySchema . Properties [ description . Name ] = await _componentService . GetOrCreateSchemaAsync ( description . Type , null , cancellationToken : cancellationToken ) ;
414
414
}
415
415
schema . AllOf . Add ( propertySchema ) ;
416
416
}
417
417
else
418
418
{
419
419
foreach ( var description in parameter )
420
420
{
421
- schema . Properties [ description . Name ] = await _componentService . GetOrCreateSchemaAsync ( description . Type , null , cancellationToken ) ;
421
+ schema . Properties [ description . Name ] = await _componentService . GetOrCreateSchemaAsync ( description . Type , null , cancellationToken : cancellationToken ) ;
422
422
}
423
423
}
424
424
}
@@ -465,7 +465,7 @@ private async Task<OpenApiRequestBody> GetJsonRequestBody(IList<ApiRequestFormat
465
465
foreach ( var requestForm in supportedRequestFormats )
466
466
{
467
467
var contentType = requestForm . MediaType ;
468
- requestBody . Content [ contentType ] = new OpenApiMediaType { Schema = await _componentService . GetOrCreateSchemaAsync ( bodyParameter . Type , bodyParameter , cancellationToken ) } ;
468
+ requestBody . Content [ contentType ] = new OpenApiMediaType { Schema = await _componentService . GetOrCreateSchemaAsync ( bodyParameter . Type , bodyParameter , captureSchemaByRef : true , cancellationToken : cancellationToken ) } ;
469
469
}
470
470
471
471
return requestBody ;
0 commit comments