bionode-watermill icon indicating copy to clipboard operation
bionode-watermill copied to clipboard

json schema validator on input, output, action stream

Open thejmazz opened this issue 8 years ago • 1 comments

Would be super simple, essentially wrap a module into (x, f) => f(x) where f(x) is true or f(x) is false. x can then be something like

require('is-my-schema-valid')({
  required: true,
  type: 'object',
  properties: {
    rna-fastq: {
      required: true,
      type: RegExp
      pattern: new RegExp(`^${speciesName}.${run}.fastq.gz`)
    }
  }
})

However just realized perhaps is-my-schema-valid cannot compare RegExp objects as they are not by default in JSON.stringify(). @mafintosh, how difficult to extend the plugin, perhaps similar like replacer and reviver functions to faciltate comparisons of objects?

Taking a hint from how webpack lets you choose loaders based on regexing (somewhat implicit understood) filetypes, could apply arrows of validators to specific files, or subtrees of resolved output objects.

thejmazz avatar Jul 21 '16 03:07 thejmazz

this is related to #75

thejmazz avatar Aug 25 '17 15:08 thejmazz