Home FormatAttributeHandler Class
FormatAttributeHandler Class
Cancel

FormatAttributeHandler Class

Namespace: Json.Schema.Generation.DataAnnotations

Inheritance: FormatAttributeHandler<T> 🡒 object

Implemented interfaces:

  • IAttributeHandler<T>
  • IAttributeHandler

Base class for attributes that just need to add a format keyword.

Constructors

FormatAttributeHandler<T>(string format)

Creates a new handler that uses a custom format.

Declaration

1
public FormatAttributeHandler`1(string format)
ParameterTypeDescription
formatstringThe format.

FormatAttributeHandler<T>(Format format)

Creates a new handler that uses a predefined format.

Declaration

1
public FormatAttributeHandler`1(Format format)
ParameterTypeDescription
formatFormatThe format.

Methods

AddConstraints(SchemaGenerationContextBase context, Attribute attribute)

Processes the type and any attributes (present on the context), and adds intents to the context.

Declaration

1
public virtual void AddConstraints(SchemaGenerationContextBase context, Attribute attribute)
ParameterTypeDescription
contextSchemaGenerationContextBaseThe generation context.
attributeAttributeThe attribute.

Remarks

A common pattern is to implement Json.Schema.Generation.IAttributeHandler on the attribute itself. In this case, the parameter will be the same instance as the handler and can likely be ignored.

Contents