core icon indicating copy to clipboard operation
core copied to clipboard

Complex endpoint argument not generated when marked as query parameter

Open rbauduin opened this issue 2 years ago • 0 comments

I was switching a parameter to a WebSharper Endpoint from being mapped in the path to being a GET parameter (here). That parameter has this type:

type TableType =
    | Main
    | Linked of LinkedTableInfo
    with
    override self.ToString() =
        match self with
        | Main -> "main"
        | Linked l -> l.ToString()

and LinkedTableInfo is a record type:

    type LinkedTableInfo = {
          sourceInstanceId: Ids.InstanceId
          direction: Ids.RelationAndDirection
        }

with both fields InstanceId and RelationAndDirection being DU types. When mapping it to the path, the Linked case appeared correctly in the path:

http://localhost:5000/get_table_csv/Linked/InstanceId/51377/ParentsVia/RelationId/401/608/1/10/year/Asc?searchValue=

but as a GET parameter, it is not present:

http://localhost:5000/get_table_csv/608/1/10/year/Asc?searchValue

The Main case appears correctly in the URL: http://localhost:5000/get_table_csv/12/1/10/nom/Asc?searchValue=&tableType=Main only the Linked case is absent I'm doing this because I'm mapping a RPC function taking these args to an endpoint.

rbauduin avatar Jun 26 '22 11:06 rbauduin