-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
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
DynamicObjusing theinit(and optionallystyle/applyMemberspattern, 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), andconvert, which boxes the result oftoStringsee for example here:
Dash.NET/src/Dash.NET/DashComponents/ComponentBase.fs
Lines 41 to 61 in f869c10
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
Reactions are currently unavailable