rjrodger / gubu

Gubu is a WYSIWYG schema validator for JavaScript.
MIT License
2 stars 2 forks source link

Vanilla JS format is needed #3

Open rjrodger opened 2 years ago

rjrodger commented 2 years ago

This allows shape def without importing Gubu

perhaps

const shapeDef = {
  foo: 1,
  // Normally: bar: Required(Open({ zed: true })),
  bar: { $:'Required', _:{ $:'Open', zed: true }}
}
rjrodger commented 2 years ago

Or:

function Open(...args) { return args }
function Required(...args) { return args }

And recognize the function names (with config flag)

rjrodger commented 2 years ago

or use [] as these are used much less frequently in shape defs:

const shapeDef = {
  foo: 1,
  // Normally: bar: Required(Open({ zed: true })),
  bar: ['Required',['Open', {zed:true}]]
}

and "real" arrays are: ['Array',...]

rjrodger commented 9 months ago

or by modifying key: {'a: Open': {x:1}}