tursodatabase / tursodatabase/libsql

[<JsonFSharpConverter(BaseUnionEncoding = _)>] not being honored

Open
#2,278 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
17.2k
Forks
531
Avg merge
1h 12m
Merged PRs (30d)
1

Description

Example:

[<JsonFSharpConverter(BaseUnionEncoding = JsonUnionEncoding.Untagged)>]
type Sql =
  | Sql of sql: string
  | SqlId of sqlId: int
  
let options =
  JsonFSharpOptions.Default()
    .WithAllowOverride(true)
    .ToJsonSerializerOptions()

JsonSerializer.Serialize(Sql "select *", options)

type Sql =
  | Sql of sql: string
  | SqlId of sqlId: int
val options: JsonSerializerOptions
val it: string = "{"Case":"Sql","Fields":["select *"]}"

Expecting {"sql":"select *"} .

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the F# reproduction using JsonFSharpConverter, JsonFSharpOptions.Default(), and JsonUnionEncoding.Untagged, then compare the actual serialization with the expected output. Trace why the attribute is not honored when JsonSerializer.Serialize is called; done means the example produces {"sql":"select *"}.

Written by the indexing model from the issue text.

Assessment

Tech stack
fsharp
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.