Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swagger Serializer Settings #652

Open
jnoren1 opened this issue Apr 23, 2024 · 0 comments
Open

Swagger Serializer Settings #652

jnoren1 opened this issue Apr 23, 2024 · 0 comments

Comments

@jnoren1
Copy link

jnoren1 commented Apr 23, 2024

Describe the issue
I cannot find anywhere that allows me to set the settings or even which serializer swagger uses to serialize my objects. I utilize custom serializer settings (Newtonsoft) that send my objects differently depending on the destination. In my application these settings change the output or even hide fields.

For example, to a database, I may want ENUMs to use numbers for storage, but for APIs (and swagger) I would want strings. Or I may want some fields exposed for different levels of authentication for a publicly available API. Decorating functions won't work because the I need the behavior to change at runtime.

I've seen the following as recommendation in the issues, but this seems to have no effect whatsoever. Sadly I've not been able to find anything else in the documentation.

var host = new HostBuilder()
    .ConfigureFunctionsWebApplication(builder =>
    {
        builder.UseNewtonsoftJson();
    })
    .Build();
host.Run();

The Question
What serializer is used by swagger/openapi?
How can one alter the settings and add customer converters?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant