Logo GenPRES

Nested Module

Reads a Dto or an array of Dtos with a given reader. A Dto that is null after JSON deserialization gives a Missing error with its path.

Functions and values

Function or value Description

items path read xs

Full Usage: items path read xs

Parameters:
    path : string
    read : string -> 'a -> Result<'b, DtoError list>
    xs : 'a[]

Returns: Result<'b list, DtoError list>
Type parameters: 'a, 'b

Reads every Dto of an array with read; a null array reads as an empty array. Each item gets the path and its index, such as "Components[0]", and a null item gives DtoError.Missing with that path. Returns the errors of every item that fails.

path : string
read : string -> 'a -> Result<'b, DtoError list>
xs : 'a[]
Returns: Result<'b list, DtoError list>

required name dto read

Full Usage: required name dto read

Parameters:
Returns: Result<'b, DtoError list>
Type parameters: 'a, 'b

Reads the Dto with read. A Dto that is null after JSON deserialization gives DtoError.Missing name.

name : string
dto : 'a
read : 'a -> Result<'b, DtoError list>
Returns: Result<'b, DtoError list>

Type something to start searching.