readme.md in render-0.0.8 vs readme.md in render-0.0.9
- old
+ new
@@ -1,12 +1,12 @@
# Render
-Render improves the way you work with APIs.
+Render improves the way you work with APIs by dynamically modeling/requesting from [JSON Schemas](http://json-schema.org/) or Ruby equivalents thereof.
-* [Generate type-specific, dynamic API response data for testing](spec/integration/render/schema_spec.rb) with just a schema (JSON or Ruby)
+* [Generate type-specific, dynamic API response data for testing](spec/integration/render/schema_spec.rb) with just a schema
* [Make API requests](spec/integration/render/graph_spec.rb) with a URL and a schema
-* Build graphs that [interpret data from one endpoint to call others](spec/integration/render/nested_graph_spec.rb)
+* Build Graphs that [interpret data from one endpoint to call others](spec/integration/render/nested_graph_spec.rb)
## Setup
Update your Gemfile:
@@ -14,19 +14,76 @@
## Usage
Check out examples as part of the [integration tests](spec/integration/render).
-## Caveats
+```ruby
+# Make requests
+Render::Definition.load_from_directory!("/path/to/json/schema/dir")
+Render::Graph.new("loaded-schema-id", { host: "films.local" }).render!
-- Render is under initial development
+# Or mock data
+Render.live = false
+planned_schema = {
+ definitions: {
+ address: {
+ type: Object,
+ properties: {
+ number: { type: Integer },
+ street: { type: String }
+ }
+ }
+ },
+ type: Object,
+ properties: {
+ name: { type: String, minLength: 1 },
+ email: { type: String, format: :email },
+ sex: { type: String, enum: %w(MALE FEMALE) },
+ address: { :$ref => "#/definitions/address" },
+ nicknames: {
+ type: Array,
+ minItems: 1,
+ maxItems: 1,
+ items: { type: String }
+ }
+ }
+}
+
+mock_data = Render::Schema.new(planned_schema).render!
+# {
+# :name => "name (generated)",
+# :email => "you@localhost",
+# :sex => "FEMALE",
+# :address => {
+# :number => 513948,
+# :street => "street (generated)"
+# },
+# :nicknames => ["nicknames (generated)"]
+# }
+```
+
+## Caveats/Notes/Assumptions
+
+Render is not meant to be a validator and ignores:
+
+ - Keywords that do not additively define schemas: `not`, `minProperties`, `maxProperties`, `dependencies`
+ - Divergent responses, e.g. no errors will be raised if "abc" is returned for String with { "minLength": 4 }
+
+It will help out, though, and defensively type response values based on definition (so you don't run into issues like `"2" > 1`).
+
## Roadmap
-1. Custom headers (e.g. { pragma: "no-cache", host: "dont_redirect_to_www.site.com" })
-2. Enhance Attribute metadata (e.g. minlength)
-3. Enhance Graph to Graph relationships
-4. Custom request strategy
+- `links` implementation as opposed to `endpoint`
+- Expanded keyword implementations:
+ - additionalProperties, anyOf, allOf, oneOf
+ - pattern/patternProperties
+ - Tuples of varying types, e.g. [3, { name: "bob" }]
+- Relating to requests
+ - Custom options, e.g. headers, timeouts
+ - Drop-in custom requesting
+- Enhanced relationship calculation between nested Graphs
+- Enhanced $ref implementation
## Contributing
* Bugs and questions welcomed. If you know (or kind of know) what's going on:
* Write a failing test, kudos for solving it