git.iko.soy/typeable/schematic
on master help sign in
minimal proofreading
commit9e4a67064afaf3046a7019864ca51352d00c0bf5 authorDenis Redozubov <denis.redozubov@gmail.com> dateThu 24 Aug 2017, 13:43 (9 years ago) parent20f1e21
1 file changed+13−12
README.md+13−12
README.md+13−12
@@ -37,13 +37,13 @@ type SchemaExample
3737 , '("bar", SchemaOptional (SchemaText '[TEnum '["foo", "bar"]]))]
3838```
3939
40−* This schema says that's structurally it's a JSON object which has two field:
41− * field "foo" contains an of numeric values
42− * field "bar" contains an optional textual value
43−* It also allows you to validate the JSON:
44− * an array in "foo" must contain exactly one element
40+* This schema says that's structurally it's a JSON object which has two fields:
41+ * field "foo" contains an array of numeric values
42+ * field "bar" contains an optional text value
43+* It also allows you to validate JSON values itself:
44+ * an array in "foo" contains exactly one element
4545 * that element must be strictly greater than 10
46− * value of bar must be either "foo" or "bar" if presented
46+ * value of "bar" field must be either "foo" or "bar" if presented
4747
4848
4949This one is valid for example
@@ -67,11 +67,12 @@ decodeAndValidateJson schemaJson :: ParseResult (JsonRepr SchemaExample)
6767```
6868
6969`ParseResult` type encodes three possible situations:
70−* json is structurally consistent with schema and runtime validations passed
71−* json source is malformed or doesn't correspond to schema structurally
72−* some of the runtime validations failed, but it's structurally correct
70+* json is structurally consistent with a schema and runtime validations pass
71+* json source is malformed or doesn't correspond to a schema structurally
72+* some of the runtime validations have failed, but it's structurally correct
73+ overall
7374
74−I t's build a transport layer representation of that data that can be tranversed and transformed to whatever internal types user has. Transport layer represetation looks like this. Type parameter is the schema itself.
75+It implies a transport layer representation of that data that can be traversed and transformed to whatever internal types user has. It's called `JsonRepr`. Type parameter is the schema itself.
7576
7677
7778```
@@ -84,9 +85,9 @@ jsonExample = ReprObject $
8485
8586## Migrations
8687
87−It's possible to represent schema changes as a migration, which describes a series of json-path/change pairs. Migrations can be applied in succession.
88+It's possible to represent schema changes as a series of migrations, which describes a series of json-path/change pairs. Migrations can be applied in succession.
8889
89−This piece of code will apply a migration to the schema, then decodes and validates the latest version.
90+This piece of code will apply a migration to the schema, decode and validate the latest version.
9091
9192```
9293type SchemaExample