Allan
Allan

Reputation: 115

How can I configure swagger-ui to emit camelcase json variables instead of underscores when using with ServiceStack?

I am using ServiceStack.Api.Swagger. Everything is working and I can see my api docs fine. I have configured ServiceStack to emit camel case name JsConfig.EmitCamelCaseNames = true; and ServiceStack is emitting the variables as expected (e.g trainStation). However when I view the Request/Response schemas in my swagger output/screen, all of the variables that ServiceStack emits as camel case are displayed with an underscore separator (e.g. train-station). Is there a way to configure swagger-ui to emit camel case instead of underscores? Or, configure ServiceStack and swagger-ui to be consistent?

Upvotes: 3

Views: 2547

Answers (1)

Mike Mertsock
Mike Mertsock

Reputation: 12025

There are properties on the SwaggerFeature class. In your AppHost, after configuring JsConfig:

Plugins.Add(new SwaggerFeature {
    UseCamelCaseModelPropertyNames = JsConfig.EmitCamelCaseNames
});

Upvotes: 2

Related Questions