Skip to content

Unify object generation and serialization approaches #36

@kMutagene

Description

@kMutagene

The overall strategy for creating objects to serialize and serve via the dash app endpoints should be the same everywhere:

  • When it is a object with no optional fields:

    -> Record type with [<JsonProperty>] attribute indicating the correct json property name

  • When it is an object with optional fields:

    -> class inheriting from DynamicObj using the init(and optionally style/applyMembers pattern, see Optional component record fields #29)

  • When it is an enum:

    DU with the following static members: toString (which converts to the correct string for the js enum), and convert, which boxes the result of toString see for example here:

    type InputType =
    | Text
    | Number
    | Password
    | Email
    | Range
    | Search
    | Tel
    | Url
    | Hidden
    static member toString = function
    | Text -> "text"
    | Number -> "number"
    | Password -> "password"
    | Email -> "email"
    | Range -> "range"
    | Search -> "search"
    | Tel -> "tel"
    | Url -> "url"
    | Hidden -> "hidden"
    static member convert = InputType.toString >> box

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions