FSharp.Data icon indicating copy to clipboard operation
FSharp.Data copied to clipboard

JSON optional property

Open codingedgar opened this issue 5 years ago • 0 comments

Hi! Thank you for this amazing lib.

I'm having an issue, when I'm Using this JSON

[
  {
    "error": {
      "message": "Error validating access token: Session has expired on Friday, 24-Jul-20 16:00:00 PDT. The current time is Friday, 24-Jul-20 16:06:14 PDT.",
      "type": "OAuthException",
      "code": 190,
      "error_subcode": 463,
      "fbtrace_id": "A0yQG8l8ggauD5PMbYSnEyA"
    }
  },
  {
    "error": {
      "message": "Error validating access token: Session has expired on Friday, 24-Jul-20 16:00:00 PDT. The current time is Friday, 24-Jul-20 16:06:14 PDT.",
      "type": "OAuthException",
      "code": 190,
      "error_subcode": 463,
      "fbtrace_id": "A0yQG8l8ggauD5PMbYSnEyA"
    }
  },
  {
    "data": [
      {
        "id": "17841511906082530"
      }
    ]
  }
]

The field error is read as Optional<Error> meanwhile the field data is Datum [], It should be Optional<Data>, this error seems to have something to do with the array, if I change the value of data to another type, like a number, it correctly infers the type.

Maybe is some cache that's wrong? How could I reset the TypeProvider cache?

codingedgar avatar Jul 27 '20 05:07 codingedgar