Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated #extend_schema_definition #335

Merged

Conversation

iainbeeston
Copy link
Contributor

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.

@iainbeeston
Copy link
Contributor Author

Incidentally this also includes the fix from #315

@iainbeeston iainbeeston force-pushed the deprecate-extend-schema-definition branch from 454b8fd to b8d1e18 Compare September 29, 2016 13:55
@iainbeeston iainbeeston force-pushed the deprecate-extend-schema-definition branch 3 times, most recently from 053cdc4 to 839b873 Compare February 1, 2017 11:14
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.
@iainbeeston iainbeeston force-pushed the deprecate-extend-schema-definition branch from 839b873 to c9f9afc Compare February 1, 2017 11:36
@iainbeeston iainbeeston merged commit 0993575 into voxpupuli:master Feb 1, 2017
@iainbeeston iainbeeston deleted the deprecate-extend-schema-definition branch February 1, 2017 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant