Skip to content

AddOpenApi not respect JsonSerializerOptions Configurations #59980

@mu-dawood

Description

@mu-dawood

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I'm configuring my json options using

builder.Services.AddControllers().AddJsonOptions(x =>
            {
                x.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter());
                x.JsonSerializerOptions.PropertyNamingPolicy = System.Text.Json.JsonNamingPolicy.SnakeCaseLower;
            })
/// add open api
builder.Services.AddOpenApi();

But the generated schema neither respect JsonStringEnumConverter nor SnakeCaseLower

Expected Behavior

No response

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    ✔️ Resolution: AnsweredResolved because the question asked by the original author has been answered.Status: Resolvedarea-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-openapi

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions