Skip to content

JsonProvider accepts absurd input #1241

@akdor1154

Description

@akdor1154

JsonProvider doesn't seem to care if non-optional fields are completely missing, it happily infers them as an empty string.

type MyType = JsonProvider<"""{"field": "asdf"}""">

[<Fact>]
let ``json test`` () =
    let t = MyType.Parse("""{"not":"valid"}""")
    printf "field: \"%s\". type: %O" t.Field (t.Field.GetType())

Expected behaviour - should throw an exception.
Actual behaviour:
field: "". type: System.String

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions