From 473f7b16c9b29d9aa93ba8b76979cfab5b564b9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=88o=20Martiniak?= Date: Fri, 25 Oct 2024 13:01:12 +0200 Subject: [PATCH] Update openAPI_completion.md This PR addresses two documentation inaccuracies: Updated usage of the outdated method `UseSchemaTransformer`, which has been replaced by `AddSchemaTransformer` in recent versions of .NET. Corrected type checking syntax from `if (c.Type == typeof(Product))` to `if (c.JsonTypeInfo.Type == typeof(Product))`, aligning with the current API structure for accessing type information. --- .../release-notes/aspnetcore-9/includes/openAPI_completion.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aspnetcore/release-notes/aspnetcore-9/includes/openAPI_completion.md b/aspnetcore/release-notes/aspnetcore-9/includes/openAPI_completion.md index 01271735b99d..63f37111ab15 100644 --- a/aspnetcore/release-notes/aspnetcore-9/includes/openAPI_completion.md +++ b/aspnetcore/release-notes/aspnetcore-9/includes/openAPI_completion.md @@ -89,9 +89,9 @@ var builder = WebApplication.CreateBuilder(); builder.Services.AddOpenApi(options => { - options.UseSchemaTransformer((schema, context, cancellationToken) => + options.AddSchemaTransformer((schema, context, cancellationToken) => { - if (context.Type == typeof(Todo)) + if (context.JsonTypeInfo.Type == typeof(Todo)) { schema.Example = new OpenApiObject {