[Bug]: Cannot load document with examples using Microsoft.OpenApi version 2.6.0
bug
### Version
2.0.0
### Describe the bug
Cannot load document if using new [2.6.0 version from Microsoft.OpenApi](https://github.com/microsoft/OpenAPI.NET/releases/tag/v2.6.0)
with
```csharp
services.AddOpenApiExtensions(opt =>
{
opt.AddServerUrls = false;
opt.AddExamples = true;
opt.SerializationContexts.Add(DateOnlyJsonSerializerContext.Default);
opt.AddExample<DateOnly, DateOnlyExampleProvider>();
});
public sealed class DateOnlyExampleProvider : IExampleProvider<DateOnly>
{
public static DateOnly GenerateExample() => DateOnly.FromDateTime(DateTime.UtcNow);
}
[JsonSerializable(typeof(DateOnly))]
[JsonSourceGenerationOptions(
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
NumberHandling = JsonNumberHandling.Strict,
PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase,
WriteIndented = true)]
public sealed partial class DateOnlyJsonSerializerContext : JsonSerializerContext;
```
### Expected behaviour
_No response_
### Actual behaviour
_No response_
### Steps to reproduce
_No response_
### Exception(s) (if any)
```text
`Method not found: 'System.Collections.Generic.IDictionary`2<System.String,Microsoft.OpenApi.OpenApiMediaType> Microsoft.OpenApi.IOpenApiResponse.get_Content() at MartinCostello.OpenApi.Transformers.AddExamplesTransformer.TryAddResponseExamples(OpenApiResponses responses, ApiDescription description, IList`1 examples)\r\n at MartinCostello.OpenApi.Transformers.AddExamplesTransformer.TryAddResponseExamples(OpenApiResponses responses, ApiDescription description, IList`1 examples)\r\n at MartinCostello.OpenApi.Transformers.AddExamplesTransformer.Process(OpenApiOperation operation, ApiDescription description)\r\n at MartinCostello.OpenApi.Transformers.AddExamplesTransformer.TransformAsync(OpenApiOperation operation, OpenApiOperationTransformerContext context, CancellationToken cancellationToken)\r\n at Microsoft.AspNetCore.OpenApi.OpenApiDocumentService.GetOperationsAsync(IGrouping`2 descriptions, OpenApiDocument document, IServiceProvider scopedServiceProvider, IOpenApiOperationTransformer[] operationTransformers, IOpenApiSchemaTransformer[] schemaTransformers, CancellationToken cancellationToken)\r\n at Microsoft.AspNetCore.OpenApi.OpenApiDocumentService.GetOpenApiPathsAsync(OpenApiDocument document, IServiceProvider scopedServiceProvider, IOpenApiOperationTransformer[] operationTransformers, IOpenApiSchemaTransformer[] schemaTransformers, CancellationToken cancellationToken)\r\n at Microsoft.AspNetCore.OpenApi.OpenApiDocumentService.GetOpenApiDocumentAsync(IServiceProvider scopedServiceProvider, HttpRequest httpRequest, CancellationToken cancellationToken)\r\n at Microsoft.AspNetCore.Builder.OpenApiEndpointRouteBuilderExtensions.<>c__DisplayClass0_0.<<MapOpenApi>b__0>d.MoveNext()\r\n--- End of stack trace from previous location`
```
### .NET Version
.NET 10.0.102 / 10.0.2
### Anything else?
_No response_
1 条评论