Skip to content

Commit addd405

Browse files
authored
Merge branch 'main' into repo-assist/fix-json-decimal-float-1230-a945dd1e3b1536f6
2 parents 3f1bd28 + cd7a7a0 commit addd405

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

docs/library/JsonProvider.fsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,9 +369,12 @@ printfn "%s (retweeted %d times)\n:%s" tweet.User.Value.Name tweet.RetweetCount.
369369

370370
(**
371371
After creating the `Tweet` type, we parse a single sample tweet and print some details about the
372-
tweet. As you can see, the `tweet.User` property has been inferred as optional (meaning that a
373-
tweet might not have an author?) so we unsafely get the value using the `Value` property.
374-
The `RetweetCount` and `Text` properties may be also missing, so we also access them unsafely.
372+
tweet. As you can see, the `tweet.User` property has been inferred as optional, and so are
373+
`RetweetCount` and `Text`. The reason is that `TwitterStream.json` contains not only tweet objects
374+
but also other event types (such as `delete` events) with a completely different schema. When the
375+
type provider merges multiple heterogeneous sample objects, any field that does not appear in all
376+
samples is inferred as optional. We unsafely get the values using the `Value` property since we
377+
know our input is a tweet.
375378
376379
## Getting and creating GitHub issues
377380

0 commit comments

Comments
 (0)