Function list

  • List indicates that this property contains a list of things. Accepts a sub model schema to serialize the contents

    Example

    class SubTask {}
    class Task {}
    class Todo {}

    createModelSchema(SubTask, {
    title: true,
    })
    createModelSchema(Todo, {
    title: true,
    subTask: list(object(SubTask)),
    })

    const todo = deserialize(Todo, {
    title: 'Task',
    subTask: [
    {
    title: 'Sub task 1',
    },
    ],
    })

    Parameters

    • propSchema: PropSchema

      to be used to (de)serialize the contents of the array

    • Optional additionalArgs: AdditionalPropArgs

      optional object that contains beforeDeserialize and/or afterDeserialize handlers

    Returns PropSchema

Generated using TypeDoc