Skip to content

All OpenAPI customization documentation broken in .NET 10 previews #35995

@DillonN

Description

@DillonN

Description

The customization documentation is broken in .NET 10 previews as apparently the types returned have changed.

E.g. this example from the docs:

builder.Services.AddOpenApi(options => {
    // Schema transformer to set the format of decimal to 'decimal'
    options.AddSchemaTransformer((schema, context, cancellationToken) =>
    {
        if (context.JsonTypeInfo.Type == typeof(decimal))
        {
            schema.Format = "decimal";
        }
        return Task.CompletedTask;
    });
});

Causes compile error:

CS0200: Property or indexer 'IOpenApiSchema.Format' cannot be assigned to -- it is read only

This is making my applications incompatible with .NET 10. What is the recommended way to make format transformations now?

Page URL

https://learn.microsoft.com/en-us/aspnet/core/fundamentals/openapi/customize-openapi?view=aspnetcore-10.0#use-schema-transformers

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/fundamentals/openapi/customize-openapi.md

Document ID

ea5fce3c-e38f-9531-b77a-3e9a5e8e30ce

Platform Id

126b754a-260a-3efc-a261-b0d72ad0d8ce

Article author

@captainsafia

Metadata

  • ID: ea5fce3c-e38f-9531-b77a-3e9a5e8e30ce
  • PlatformId: 126b754a-260a-3efc-a261-b0d72ad0d8ce
  • Service: aspnet-core
  • Sub-service: fundamentals

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions