Skip to content
Sergej edited this page Dec 20, 2019 · 2 revisions

List validation

⚠ Not yet supported.
No proposed implementation:

Array of objects

const schema = new Schema<Model>()
  .with(x => x.ObjArrayProp, new ArraySchema({
    items: new Schema<Model2>()
      .with(x => x.Lvl2ObjProp.Lvl3StrProp, new StringSchema({
        minLength: 1
      }))
  }))
  .build();

Tuple validation

const schema = new Schema<Model>()
    .with(m => m.ArrayProp, new ArraySchema({
        items: [1, 2],
        additionalItems: false
    })))
    .build();

Length

const schema = new Schema<Model>()
    .with(m => m.ArrayProp, new ArraySchema({
        length: x < 3
    }))
    .build();

Supported operators: ==, ===, >=, <=, >, <

Uniqueness

const schema = new Schema<Model>()
    .with(m => m.ArrayProp, new ArraySchema({
        uniqueItems: false
    }))
    .build();
Clone this wiki locally