Class JsonSchemaPropertyValidatorFactory

java.lang.Object
org.apache.juneau.bean.jsonschema.JsonSchemaPropertyValidatorFactory
All Implemented Interfaces:
PropertyValidatorFactory

PropertyValidatorFactory implementation backed by the typed JsonSchema bean.

This factory is registered as a ServiceLoader provider for PropertyValidatorFactory via META-INF/services/org.apache.juneau.commons.bean.PropertyValidatorFactory. Marshalling-side code discovers it through PropertyValidators.factory() at runtime.

The factory converts the supplied JSON-Schema-shaped map into a JsonSchema bean via JsonSchemaBeanGenerator.toBean(JsonMap) and wraps it in a JsonSchemaValidator.

Since:
10.0.0
See Also:
  • Constructor Details

  • Method Details

    • create

      public PropertyValidator create(Map<String,Object> schemaMap, Class<?> propertyType)
      Description copied from interface: PropertyValidatorFactory
      Builds a validator from a JSON-Schema-shaped map of constraints.
      Specified by:
      create in interface PropertyValidatorFactory
      Parameters:
      schemaMap - A map mirroring the JSON Schema constraint shape (the same shape produced by SchemaAnnotation.asMap()). May be empty, in which case implementations should return null.
      propertyType - The Java type of the property being validated. May be used by the factory to choose narrower numeric or collection validators. May be null.
      Returns:
      A validator, or null if the map carries no actionable constraints.