A javascript implementation of json hyper schema.
Switch branches/tags
Nothing to show
Clone or download
Latest commit f7fb424 Sep 24, 2018
Permalink
Failed to load latest commit information.
build WIP Mar 2, 2018
demo Showing link Mar 26, 2018
docs working docs added Mar 15, 2018
src Exposing ldo Mar 26, 2018
test eslint Mar 12, 2018
.eslintrc.js CI/eslint Mar 1, 2018
.gitignore Build Mar 1, 2018
.travis.yml CI/eslint Mar 1, 2018
LICENSE Initial commit Feb 26, 2018
README.md fixed absolute Sep 21, 2018
package-lock.json support nested links Mar 9, 2018
package.json support nested links Mar 9, 2018

README.md

json-hyper-schema Build Status Coverage Status

A javascript implementation of json hyper schema.

This is currently under heavy development, expect the API to change. The tests are probably the best description of the functionality so far. So here is the spec so far:

extract sub schema
  plain schema
    ✓ return a new schema the one sub schema
    - throws if not pointing to a subschema
  non property pointer
    ✓ extracts that schema
  not keyword
    ✓ extracts the not schema
  patternProperties
    ✓ includes the schema if allOf if matching the property name
  additionalProperties
    ✓ does not include the schema if matching properties or patternProperties
    ✓ does include the schema if not matching properties or patternProperties
    ✓ does include the schema if not matching properties or patternProperties
  dependencies
    ✓ considers
    - works with nested dependencies
  schemas in arrays
    ✓ extracts allOf
    ✓ extracts anyOf
    ✓ extracts oneOf
    ✓ extracts deeply nested ones

relative json pointer util
  resolve to value
    ✓ resolves 0
    ✓ resolves 1
    ✓ resolves 1/0
    ✓ resolves 1/highly/nested/objects
    ✓ does not throw if 0 value and root reference
    ✓ throws when trying to go above the root
    ✓ throws if trying to get key of root
    ✓ resolves 0/objects
  resolve to property name
    ✓ resolves to index in array
    ✓ resolves to property name

resolver
  getTemplateData
    ✓ returns empty object when no templated parts
    ✓ returns data from instance when templated
    ✓ returns empty if not existing in the template
    ✓ supports absolute templatePointers
    ✓ supports relative templatePointers
  getDefaultInputValues
    ✓ gets an object with the default values set
    ✓ does not include values if not valid (but sets undefined)
    ✓ excludes properties with with false set in subschema
    ✓ return empty object if no input allowed
  resolve
    ✓ resolves non templated uris
    ✓ resolves links with data from instance
    ✓ does not set targetUri when it cannot be used
    ✓ provides a function for fully templating the template and enforces prefilled values
    - considers base
    requires input
      ✓ resolves values that does not allow input
      ✓ allows overriding prepopulated input


37 passing (79ms)
3 pending

Roadmap

  • Get template data from instance
  • Get default values for user input
  • Provide user input and template uri
  • Support base keyword
  • Support contextPointer
  • Relative json pointer util
  • Extract subschema util

Utils

The following utils are currently in this repository, but will probably become their own package: