There are two ways right now to extend a schema, one is by subclassing
either an existing validator (eg. JSON::Schema::Draft4) and the other is
by subclassing the base validator class (JSON::Schema::Validator) and
calling extend_schema_definition in the initializer. This method
merges the recognised json schema properties of another validator into
your new validator. Unfortunately this is effectively the same as
subclassing. What's worse, extend_schema_definition does not merge in
any of the other characteristics of a validator (eg. the formats or
names etc needed for a schema to work). All of the validator classes
that come with json-schema use subclassing, rather than
extend_schema_definition.
Because of this, I propose that we should deprecate
extend_schema_definition and encourage people to subclass instead.
There are two ways right now to extend a schema, one is by subclassing either an existing validator (eg.
JSON::Schema::Draft4
) and the other is by subclassing the base validator class (JSON::Schema::Validator
) and callingextend_schema_definition
in the initializer. This method merges the recognised json schema properties of another validator into your new validator. Unfortunately this is effectively the same as subclassing. What's worse,extend_schema_definition
does not merge in any of the other characteristics of a validator (eg. the formats or names etc needed for a schema to work). All of the validator classes that come with json-schema use subclassing, rather thanextend_schema_definition
.Because of this, I propose that we should deprecate
extend_schema_definition
and encourage people to subclass instead.