How to emit descriptions for exported JSON schema using JsonSchemaExporter

var node = JsonSchemaExporter.GetJsonSchemaAsNode(options, typeof(Product), new JsonSchemaExporterOptions
{
TreatNullObliviousAsNonNullable = true,
TransformSchemaNode = (context, node) =>
{
var description = context.PropertyInfo?.AttributeProvider?.GetCustomAttributes(typeof(DescriptionAttribute), false)
.OfType<DescriptionAttribute>()
.FirstOrDefault()?.Description;
if (description != null)
node["description"] = description;
return node;
},
});Last updated