respect
respect copied to clipboard
Object schema definition using a Ruby DSL.
In Ruby 2.1, I get: ``` lib/respect/schema.rb:252:in `to_json': unknown format '#' (ArgumentError) from /opt/rubies/2.1.4-github1/lib/ruby/2.1.0/json/common.rb:285:in `generate' from /opt/rubies/2.1.4-github1/lib/ruby/2.1.0/json/common.rb:285:in `pretty_generate' from scheme.rb:11:in `' ``` I think the `def to_json` implementation assumes some...
This chunk of code is duplicated in many places: ``` ruby rescue ValidationError => e # Reset sanitized object. self.sanitized_object = nil raise e end ```
- Pro: - More descriptive - Cons: - Will be caught by ArgumentError rescue_from...
- Forbid zero for 'divisible_by' and 'multiple_of'? A ZeroDivisionError is raised at validation time instead of a InvalidSchemaError at description time. - Valid format argument? For most of the argument...
Obviously, json-schema v3 and the draft do not provide such a constraint. They are very useful but we could not generate documentation for them. Would that be ok?
Right now there is the poorest logging system in dumpers: `Kernel.warn`. We should use a regular logger API and let the user provide its own. We could also introduce a...
I see four modules: - one for the dynamic methods (called `DynamicStatement`?) - one for the macros: `email`, `phone_number`, and `hostname` (called `FormatHelperStatement`?) - one for `doc` (called `DocStatement`?) -...
We use Ruby regexp but [json-schema.org](http://json-schema.org) uses ECMA 262 regexp. AFAIK, Ruby's regexps have more features.
Right now users can dump their schema in [JSON Schema specification draft v3](http://tools.ietf.org/id/draft-zyp-json-schema-03.html). It would be great to be able to create a schema object from such a representation.