drom / resch

:herb: React JSON Schema Form
https://beta.observablehq.com/@drom/resch-reactive-schema
MIT License
9 stars 2 forks source link

anyOf #14

Closed danziamo closed 7 years ago

danziamo commented 7 years ago
anyOf: [{
        properties: {
            veteranType: {
                enum: [''],
            }
        }
    }, {
        properties: {
            valid: {
                enum: [false],
            }
        }
    }],
    validityTrigger: true
drom commented 7 years ago

Looks like valid use case:

{
  type: 'number',
  anyOf: [
    { multipleOf: 3 },
    { multipleOf: 5 }
  ]
}

merged by anyOf

{
  type: 'number'
}
++ validator
drom commented 7 years ago

simplified implementation idea for anyOf and allOf:

  1. merge all anyOf sub-schema into single super-schema
  2. no selector needed.
  3. we can do nested anyOfs anyOfs
  4. use generic validator to check the original 'non-merged' schema.
drom commented 7 years ago

implemented:

  1. ignores anyOf for display
  2. fire tv4 for schema validation of object with anyOf