Giter Site home page Giter Site logo

signature-commons-schema's People

Contributors

jeevangelista avatar u8sand avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

jeevangelista

signature-commons-schema's Issues

Decide between `@context` / `@context+@type` / `$schema`

I've started to adopt $schema given that Loopback seems to be using that style syntax. It's possible we adopt a hybrid of the two but it needs to be formalized.

  • Visual Studio Code supports automatic recognition of $schema, which it utilizes to lint and provide autocompletion for the json which specifies it.
  • According to JSON Schema's docs, $schema should not appear in sub-schemas.
  • We'll soon need to determine a key-type for #5 (potentially $validator)
  • JSON-LD @context / @type is meant to provide semantic meaning, there is no enforcement

Integrate UI-Schema; essential display related information

Some information is more relevant for the purposes of display than others--that information should be identified in the schema and utilized in the UI for determining what gets shown (first) and what gets hidden in details.

We'll need to come up with a scheme which makes it possible to add this information to our schemas.

Some information can be directly linked to other places by URI--this is related to JSON-LD and RDF-style metadata which can and should be added both in the schema and the instance.

Formalize helper-assisted validation specification

As hinted in our tests: https://github.com/dcic/signature-commons-metadata-api/blob/master/test/acceptance/util/test-validate.ts#L47-L62
We need to create a way of getting validate to load an external script for validation.

Where standard schema validation works like this

validate({
  $schema: 'url_to_schema_used_for_validation',
  ...obj_instance
}) == ZSchema(obj, await fetch(obj.$schema))

Validator validation could work like this

validate({
  $validator: 'url_to_module_used_for_validation',
  ...actual schema instance
}) == (await import(obj.$validator))(obj)

In other words, the default $validator could just be zschema:

export default function default_validator(obj) {
  return ZSchema(obj, await fetch(obj.$schema))
}

And validate simplifies to

export default function validate(obj) {
  assertType<JSONLD>(obj)
  if(obj.$validator === undefined)
    obj.$validator = 'path_to_default_validator'
  return (await import(obj.$validator))(obj)
}

The adopted $data proposal paired with other features implemented in ajv make it an attractive target for implementing schema validation with.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.