Skip to content

Replace ApiDocMemberDetails union with a record #933

Open
@MangelMaxime

Description

@MangelMaxime

ApiDocMemberDetails is currently described as a single case DUs.

type ApiDocMemberDetails =
| ApiDocMemberDetails of
usageHtml: ApiDocHtml *
paramTypes: (Choice<FSharpParameter, FSharpField> * string * ApiDocHtml) list *
returnType: (FSharpType * ApiDocHtml) option *
modifiers: string list *
typars: string list *
extendedType: (FSharpEntity * ApiDocHtml) option *
location: string option *
compiledName: string option

This makes accessing the information in it not easy because tuples doesn't expose a named property to accessing the different values. The user is responsible, for manually naming each variables.

let (ApiDocMemberDetails(usageHtml,
                         paramTypes,
                         returnType,
                         modifiers,
                         typars,
                         baseType,
                         location,
                         compiledName)) =
    entity.Details

I propose to change this type to a record which will exposed named properties making it easier for consumer to use the type.

type ApiDocMemberDetails =
    {
        UsageHtml: ApiDocHtml 
        ParamTypes: (Choice<FSharpParameter, FSharpField> * string * ApiDocHtml) list 
        ReturnType: (FSharpType * ApiDocHtml) option 
        Modifiers: string list 
        Typars: string list 
        ExtendedType: (FSharpEntity * ApiDocHtml) option 
        Location: string option 
        CompiledName: string option
    }

// Usage
let details : ApiDocMemberDetails = // ...

details.ParamTypes 
// etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions