Sha256: a618f13ea5ac2ce5551d2a2503e677c61351ed594e2399d77a441020a017f2f5
Contents?: true
Size: 1.13 KB
Versions: 5
Compression:
Stored size: 1.13 KB
Contents
# Paradocs: Extended [Parametric gem](https://github.com/ismasan/parametric) + Documentation Generation  Declaratively define data schemas in your Ruby objects, and use them to whitelist, validate or transform inputs to your programs. Useful for building self-documeting APIs, search or form objects. Or possibly as an alternative to Rails' _strong parameters_ (it has no dependencies on Rails and can be used stand-alone). ## Installation ```sh $ gem install paradocs ``` Or with Bundler in your Gemfile. ```rb gem 'paradocs' ``` ## Getting Started Define a schema ```ruby schema = Paradocs::Schema.new do field(:title).type(:string).present field(:status).options(["draft", "published"]).default("draft") field(:tags).type(:array) end ``` Populate and use. Missing keys return defaults, if provided. ```ruby form = schema.resolve(title: "A new blog post", tags: ["tech"]) form.output # => {title: "A new blog post", tags: ["tech"], status: "draft"} form.errors # => {} ``` ## Learn more Please read the [documentation](https://paradocs.readthedocs.io/en/latest)
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
paradocs-1.1.6 | README.md |
paradocs-1.1.5 | README.md |
paradocs-1.1.4 | README.md |
paradocs-1.1.3 | README.md |
paradocs-1.1.2 | README.md |