Lesson 31. Building schemas from live data

 

Hopefully, you enjoyed using type providers in the previous lesson; this lesson builds on that one. You’ll explore the notion of building types from live data sources that exist outside your code base. You’ll learn about

  • Creating schemas from type providers from remote data sources
  • Mixing local and remote data sources
  • Avoiding issues when working with remote data sources

31.1. Working with JSON

In this section, we’ll cover the basics of working with JSON data files with type providers.

31.1.1. Live and local files

In the previous lesson, you saw how to work with a type provider operating against a local data source—a CSV file placed on the local filesystem. As it turns out, many type providers also offer the ability to work against remote data sources; indeed, some providers are designed to work against remote data sources as the primary way of working.

These may be resources that you own, but they might as easily be publicly available resources that you don’t own and aren’t in control of. A good example of this can be seen when working with JSON data. You might use JSON as a local storage mechanism—for example, as configuration files or local data storage. But JSON is also commonly used as a data transfer format for HTTP-enabled APIs, particularly RESTful APIs, as shown in figure 31.1.

Figure 31.1. Type providers can operate over local and remote datasets

31.2. Avoiding problems with live schemas

31.3. Mixing local and remote datasets

Summary