Home RegularExpressionAttributeHandler Class
RegularExpressionAttributeHandler Class
Cancel

RegularExpressionAttributeHandler Class

Namespace: Json.Schema.Generation.DataAnnotations

Inheritance: RegularExpressionAttributeHandler 🡒 object

Implemented interfaces:

  • IAttributeHandler<RegularExpressionAttribute>
  • IAttributeHandler

Adds a pattern keyword.

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 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.

Apply(JsonSchemaBuilder builder, string pattern)

Applies constraints for source generation.

Declaration

1
public static JsonSchemaBuilder Apply(JsonSchemaBuilder builder, string pattern)
ParameterTypeDescription
builderJsonSchemaBuilderThe schema builder.
patternstringThe regular expression pattern.

Returns

The builder for chaining.

Contents