Issue in Swagger UI and JsConfig option combo

There’s an issue in Swagger UI that seems to have to do with using it in combination with JsConfig.IncludeNullValuesInDictionaries = true;

Here’s a sample snippet that reproduces the code:

public class AppHost : AppHostBase
    {
        public AppHost(string serviceName, params Assembly[] assembliesWithServices) : base(serviceName, assembliesWithServices)
        {
            // THIS BREAKS SWAGGER-UI
            JsConfig.IncludeNullValuesInDictionaries = true;
        }

        public override void Configure(Container container)
        {
            Plugins.Add(new OpenApiFeature());
        }
    }

    [Route("/test1")]
    public class TestItem : IReturn<TestItem>
    {
        public int Id { get; set; }
        public List<string> Stuff { get; set; }
    }

    public class TestService : Service
    {
        public object Any(TestItem request)
        {
            return request;
        }
    }

The error in the console looks like this:

The error has to do with the format property being null seems like

This should now be resolved from the latest v5.8.1 that’s now available on MyGet.

1 Like