JsonSchemaProvider 0.1.0

dotnet add package JsonSchemaProvider --version 0.1.0                
NuGet\Install-Package JsonSchemaProvider -Version 0.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="JsonSchemaProvider" Version="0.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add JsonSchemaProvider --version 0.1.0                
#r "nuget: JsonSchemaProvider, 0.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install JsonSchemaProvider as a Cake Addin
#addin nuget:?package=JsonSchemaProvider&version=0.1.0

// Install JsonSchemaProvider as a Cake Tool
#tool nuget:?package=JsonSchemaProvider&version=0.1.0                

JsonSchemaProvider: F# type provider for JSON schema

NuGet Badge GitHub Actions

The JsonSchemaProvider provides F# types from JSON schemas. It can be used to build JSON values in a strongly typed way that conform to the schema or to parse JSON values into an F# value that can be queried in a stringly types way. Specifications like numeric ranges or string patterns that cannot be validated at compile time are checked at runtime.

The JSON schema can either be given as an inline string literal or by a local file.

The type provider is built around NJsonSchema for the schema parsing and validation and uses the JsonValue data type from FSharp.Data.

The version history is kept in the changelog.

See the documentation for instructions and examples how to use the type provider.

Building

The type provider requires the .NET SDK 7 or higher.

The code comes with a Dev Container specification that sets up the necessary tools and the .NET SDK.

When not inside the Dev Container, issue a

dotnet tool restore

to install the .NET tools listed in dotnet-tools.json.

The code is built using FAKE as follows.

On Linux/macOS:

./build.sh

On Windows:

build.cmd

The FAKE build script is based on MiniScaffold and provides most of its build targets. The list of available targets can be obtained by

./build.sh ListTargets

Environment Variables

  • CONFIGURATION will set the configuration of the dotnet commands. If not set, it will default to Release.
    • CONFIGURATION=Debug ./build.sh will result in -c additions to commands such as in dotnet build -c Debug

Debugging

Debugging type providers requires to run the FSharp compiler or interpreter on a source file using the type provider since the provider's code is executed in the compilation pipeline. See the comments in debugUtils/debug.fsx how to launch the code in the Ionide debugger.

License

The JSON schema type provider is available under the MIT license. For more information see license file.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.1.0 126 5/28/2024
0.1.0-pre.5 72 5/25/2024
0.1.0-pre.4 203 10/18/2023
0.1.0-pre.3 70 10/17/2023

## [0.1.0] - 2024-05-28

[0.1.0]: https://github.com/florenzen/JsonSchemaProvider//compare/v0.1.0...v0.1.0

### Added
- A cache to avoid repeatedly parsing the schema file or string.
- A draft of the manual.
- Basic README file.
- ListTarget target for the FAKE automation.
- Meta data for the NuGet package.
- Publish package to nuget.org.
- Basic support for JSON Schemas with objects at the outer level.

### Fixed
- Nested arrays are possible.
- Fix publishing package to nuget.org.

### Changed
- The type provider uses several internal abstract representations before
 generating the code of the provided type.