Swagger settings for FSharp.SystemTextJson. Still experimantal
Only replace AddSwaggerGen with AddSwaggerForSystemTextJson
let builder = WebApplication.CreateBuilder(args)
let fsOptions = JsonFSharpOptions() // setup options here
//setup usage of JsonFSharpConverter
builder.Services.AddControllers()
.AddJsonOptions(fun opts ->
opts.JsonSerializerOptions.Converters.Add(JsonFSharpConverter(fsOptions)))
// setup usage of SwaggerForSystemTextJson - use instead AddSwaggerGen
builder.Services.AddSwaggerForSystemTextJson(fsOptions)
let app = builder.Build()
if (app.Environment.IsDevelopment()) then
app.UseSwagger() |> ignore
app.UseSwaggerUI() |> ignore
Not everything is now implemented. Some things works with limitations
- Works
- All properties are required except of Skippable
- Option properties are set as nullable
- Works
- Evaluates to array of composed type
- Array has length limits to tuple length
- Composed type is made as oneOf keyType and valueType
- Warning - request generated by this schema could be invalid.
- List and Set: works
- Maps
- with string keys - works
- with boxed string - works
- other - works
- Evaluates to array of Tuples.
- Warning - request generated by this schema could be invalid
- Almost every setup combinations works
- Still experimental