Conjecture.JsonSchema
0.29.0
dotnet add package Conjecture.JsonSchema --version 0.29.0
NuGet\Install-Package Conjecture.JsonSchema -Version 0.29.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="Conjecture.JsonSchema" Version="0.29.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Conjecture.JsonSchema" Version="0.29.0" />
<PackageReference Include="Conjecture.JsonSchema" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Conjecture.JsonSchema --version 0.29.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Conjecture.JsonSchema, 0.29.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.
#:package Conjecture.JsonSchema@0.29.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Conjecture.JsonSchema&version=0.29.0
#tool nuget:?package=Conjecture.JsonSchema&version=0.29.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Conjecture.JsonSchema
JSON Schema-driven generation for Conjecture property-based testing. Produces JsonElement values that conform to a Draft 7+ JSON Schema (file, string, or parsed JsonElement), so you can fuzz consumers of any contract that has a published schema.
Install
dotnet add package Conjecture.Core
dotnet add package Conjecture.JsonSchema
Usage
using System.Text.Json;
using Conjecture.Core;
using Conjecture.JsonSchema;
string schema = """
{
"type": "object",
"required": ["name", "age"],
"properties": {
"name": { "type": "string", "minLength": 1 },
"age": { "type": "integer", "minimum": 0, "maximum": 150 }
}
}
""";
Strategy<JsonElement> people = Strategy.FromJsonSchema(schema);
// Sample values for use in property tests, fixture seeding, contract probing, etc.
JsonElement person = people.Sample();
Console.WriteLine(person.ToString());
Strategy.FromJsonSchema accepts a string, a FileInfo, or a parsed JsonElement — pick whichever is convenient.
Types
| Type | Role |
|---|---|
Strategy.FromJsonSchema(string) / (FileInfo) / (JsonElement) |
Returns Strategy<JsonElement> conforming to the supplied schema. |
JsonSchemaType |
Enum of the JSON Schema primitive types (String, Integer, Number, Boolean, Object, Array, Null, Any). |
Links
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Conjecture.Core (>= 0.29.0)
- Conjecture.JsonSchema.Abstractions (>= 0.29.0)
- Conjecture.Regex (>= 0.29.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Conjecture.JsonSchema:
| Package | Downloads |
|---|---|
|
Conjecture.OpenApi
OpenAPI-driven request and body strategies for Conjecture property-based testing. |
GitHub repositories
This package is not used by any popular GitHub repositories.