README.md in strong_json-0.0.4 vs README.md in strong_json-0.1.0

- old
+ new

@@ -1,11 +1,11 @@ # StrongJSON This library allows you to test the structure of JSON objects. This is similar to Strong Parameters, which is introduced by Rails 4, but expected to work with more complex structures. -It may help you to understand what this is as: Strong Parameter is for simple structures, like HTML forms, and StrongJSON is for complex structures, like JSON objects posted to API. +It may help you to understand what this is as: Strong Parameters is for simple structures, like HTML forms, and StrongJSON is for complex structures, like JSON objects posted to API. ## Installation Add this line to your application's Gemfile: @@ -31,24 +31,23 @@ end json = s.order.coerce(JSON.parse(input)) ``` -If the input JSON data is conformant with `order`'s structure, the `json` will be that value. +If the input JSON data conforms to `order`'s structure, the `json` will be that value. -If the input JSON contains attributes which is not white-listed in the definition, the fields will be droped. +If the input JSON contains attributes which is not white-listed in the definition, it will raise an exception. If an attribute has a value which does not match with given type, the `coerce` method call will raise an exception `StrongJSON::Type::Error`. -If the input JSON contains `prohibited` attributes, `id` of `item` in the example, it also will result in an exception. ## Catalogue of Types ### object(f1: type1, f2: type2, ...) * The value must be an object * Fields, `f1`, `f2`, and ..., must be present and its values must be of `type1`, `type2`, ..., respectively -* Other fields will be ignored +* Objects with other fields will be rejected ### array(type) * The value must be an array * All elements in the array must be value of given `type` @@ -63,10 +62,10 @@ * `number` The value must be an instance of `Numeric` * `string` The value must be an instance of `String` * `boolean` The value must be `true` or `false` * `numeric` The value must be an instance of `Numeric` or a string which represents a number * `any` Any value except `nil` is accepted -* `prohibited` Any value will be rejected +* `ignored` Any value will be ignored ### Shortcuts There are some alias for `optional(base)`, where base is base types, as the following: