Skip to content

Yaml type provider: Can't read a list of objects #167

@Kurren123

Description

@Kurren123

My config.yaml:

Targets:
  - Target: 1 0 1 0
    NoSlots: 2
    
  - Target: -1 0 -1 -1
    NoSlots: 2


Tiles:
  - 1 0 0 0
  - 0 0 1 0
  - -1 0 0 0
  - 0 0 -1 -1

My code:

open FSharp.Configuration
type Config = YamlConfig<"config.yaml">
let config = Config()
printfn "Number of targets: %d" config.Targets.Count

Output: Number of targets: 1

Operating system: Windows
Target framework: .net 6
Package version: 2.0.0

Any help to be able to parse the list of objects "Targets" would be much appreciated!

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