Skip to content
No description, website, or topics provided.
F# Other
  1. F# 98.4%
  2. Other 1.6%
Branch: master
Clone or download


The goal of this project is to provide generation of idiomatic JSON Schema definitions for F# types.

Why JSON Schema?

JSON Schema is a standard, evolving format for specifying the structure of JSON documents. Tools exist for generating nicely formatted JSON from F#, e.g. FSharpLu.Json, Newtonsoft.Json.FSharp, and Newtonsoft.Json.FSharp.Idiomatic. Newtonsoft.Json Schema and NJsonSchema provide a way to generate and validate JSON Schema for .NET languages, but these don't necessarily translate well to F# types, e.g. anyOf mapping to F#'s discriminated unions.

Which JSON Schema?

.NET offers several possibile targets:

  • Newtonsoft.Json Schema - complete schema generation and validation
  • NJsonSchema - OSS JsonSchema generator and validator, used in NSwag.
  • OpenAPI.NET - part of the Open API toolkit for defining Open API's version of JSON Schema but no built-in validation


This library takes the approach of using F# Reflection to generate the JSON Schema matching intended JSON output. For the initial implementation, FSharp.Data.JsonSchema uses Newtonsoft.Json.FSharp.Idiomatic as its target JSON format. For the greatest freedom in generating and validating JSON Schema, this library uses NJsonSchema. A later goal is to allow the schema generation to be driven by additional options.

You can’t perform that action at this time.