salesking / json_schema_tools

Tools for building and handling a JSON Schema powered API's
27 stars 9 forks source link

has_schema_attributes should accept schema from Ruby hash #5

Closed anicholson closed 11 years ago

anicholson commented 11 years ago

Currently, the only way to add schema attributes to a class is from a static file-based definition.

Now that #3 has been merged, we should be able to do this using dynamic schemas too:

class Example
  include SchemaTools::Modules::Attributes

  has_schema_attrs :example, :schema => { ... }
end

Useful, because my app returns documents from an API, along with the schema used to validate it. I want to be able to maintain as much interface-compatibility as possible :)