Skip to content

Support for Attributes? #48

Description

@thautwarm

I'm now happy with Fable's reflection, which allows me to do what pydantic does in the python world.

However I want to step further. I want to allow syntax sugars in the configuration, but get the same syntax tree.

type github_url= { url: string;  [<Default("main")>] branch: string}

type myconfig = 
{
   [<AllowSingular>] author: string array
   url : github_url
    ...
}

By using attributes, I want to control JSON deserialization, to parse into the same results for

{
    "author" :  ["fable"],
    "url" : { "name": "xxx/xxx", "branch", "main" },
    ...
}

and

{ 
    "author":  "fable",
    "url": "xxx/xxx"
}

Is the use of attributes possible in Fable?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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