Swashbuckle.AspNetCore
Swashbuckle.AspNetCore copied to clipboard
JObject types not represented as "object" in V2 spec
I'm using v6.2.2 and swaggerOptions.SerializeAsV2 = true
.
Consider a class
public class Foo {
public JObject Bar { get; set; }
}
In the generated specification, I would expect the Bar property to be decorated with "type": "object"
, however it is not decorated with a "type"
at all.
I that see #1766 removed the conversion of JObject to DataType.Object
. I also see that GenerateSchema_GeneratesOpenSchema_IfDynamicJsonType explicitly tests to ensure that JObject types are not assigned a schema type. This change seems intentional... but why?
My current workaround is to include
swaggerGenOptions.MapType<JObject>(() => new OpenApiSchema { Type = "object" });