serializr
    Preparing search index...

    Function alias

    • Alias indicates that this model property should be named differently in the generated json. Alias should be the outermost propschema.

      Parameters

      • name: string

        name of the json field to be used for this property

      • OptionalpropSchema: PropDef

        propSchema to (de)serialize the contents of this field

      Returns PropSchema

      createModelSchema(Todo, {
      title: alias('task', primitive()),
      })

      serialize(new Todo('test')) // { "task": "test" }