Skip to content

Custom Schema Properties

Rico Suter edited this page Jun 30, 2020 · 7 revisions
  • Package: NJsonSchema.Annotations
  • Usages: The attribute is processed by the JsonSchemaGenerator

With the JsonSchemaExtensionDataAttribute attribute, you can add custom properties to the generated JSON Schema. Keep in mind that JSON Schema only allows x--prefixed property names.

The attribute can be used on properties and classes:

[JsonSchemaExtensionData("x-ui-color", "blue")]
public class Person
{
    [JsonSchemaExtensionData("x-ui-multiline", "true")]
    public string Description { get; set;}
}
Clone this wiki locally