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

Refactor classes and validator accessor methods #130

Merged
merged 3 commits into from Sep 29, 2014

Conversation

iainbeeston
Copy link
Contributor

There are a few things that have been bugging me in the json-schema codebase, that I thought I could clean up. Here's a summary:

Before After
json-schema/validator.rb defined several classes: errors classes, JSON::Schema::Validator as well as JSON::Validator I've pulled these out to their own files
The code for getting a validator (from JSON::Validator.validators[]) was duplicated in a number of places, including the internal url format used by JSON::Validator to store schemas I've made an accessor method that takes a uri string instead
JSON::Validator included the methods for getting the version string and metaschema for a validator, making it harder to add new validators I've made each validator now know about it's own version strings and metaschema instead

Hopefully this will make the code easier to understand, and make future changes easier.

@hoxworth
Copy link
Contributor

Awesome! I'll take a look over this later today along with all the other issues that have accumulated, but at a cursory glance this looks like a lot of stuff I've been wanting to do for a while...

@hoxworth
Copy link
Contributor

👍 Looks great, thanks!

hoxworth added a commit that referenced this pull request Sep 29, 2014
Refactor classes and validator accessor methods
@hoxworth hoxworth merged commit 758055c into voxpupuli:master Sep 29, 2014
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.

None yet

2 participants