NJsonSchema.Extensions
0.2.0
.NET Standard 1.3
This package targets .NET Standard 1.3. The package is compatible with this framework or higher.
.NET Framework 4.0
This package targets .NET Framework 4.0. The package is compatible with this framework or higher.
dotnet add package NJsonSchema.Extensions --version 0.2.0
NuGet\Install-Package NJsonSchema.Extensions -Version 0.2.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="NJsonSchema.Extensions" Version="0.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NJsonSchema.Extensions" Version="0.2.0" />
<PackageReference Include="NJsonSchema.Extensions" />
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 NJsonSchema.Extensions --version 0.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: NJsonSchema.Extensions, 0.2.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.
#addin nuget:?package=NJsonSchema.Extensions&version=0.2.0
#tool nuget:?package=NJsonSchema.Extensions&version=0.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
NJsonSchema.Extensions
Some extension methods for NJsonSchema.
ToJsonSchema
Convert a JObject to a NSwag JsonSchema
JObject
var instance = new JObject
{
{"Uri", new JValue(new Uri("http://localhost:80/abc?a=5"))},
{"Null", new JValue((object?) null)},
{"Guid", new JValue(_guid)},
{"Float", new JValue(10.0f)},
{"Double", new JValue(Math.PI)},
{"Check", new JValue(true)},
{
"Child", new JObject
{
{"ChildInteger", new JValue(4)},
{"ChildDateTime", new JValue(new DateTime(2018, 2, 17))},
{"ChildTimeSpan", new JValue(TimeSpan.FromMilliseconds(999))}
}
},
{"Integer", new JValue(9)},
{"Long", new JValue(long.MaxValue)},
{"String", new JValue("Test")},
{"Char", new JValue('c')},
{"Bytes", new JValue(_bytes)},
{"Array", new JArray("a1")}
};
Call ToJsonSchema
var schema = instance.ToJsonSchema().ToJson(Formatting.Indented).Replace(" ", " ");
Generated Swagger Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"Uri": {
"type": "string",
"format": "uri"
},
"Null": {
"type": "null"
},
"Guid": {
"type": "string",
"format": "guid"
},
"Float": {
"type": "number",
"format": "float"
},
"Double": {
"type": "number",
"format": "double"
},
"Check": {
"type": "boolean"
},
"Child": {
"type": "object",
"properties": {
"ChildInteger": {
"type": "integer",
"format": "int32"
},
"ChildDateTime": {
"type": "string",
"format": "date-time"
},
"ChildTimeSpan": {
"type": "string",
"format": "time-span"
}
}
},
"Integer": {
"type": "integer",
"format": "int32"
},
"Long": {
"type": "integer",
"format": "int64"
},
"String": {
"type": "string"
},
"Char": {
"type": "string"
},
"Bytes": {
"type": "string",
"format": "byte"
},
"Array": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
Convert an Jarray to a NSwag JsonSchema
Object
var instance = new JArray("a1", "a2");
Call ToJsonSchema
var schema = instance.ToJsonSchema().ToJson(Formatting.Indented).Replace(" ", " ");
Generated Swagger Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "array",
"items": {
"type": "string"
}
}
Convert a object to a NSwag JsonSchema
object
var instance = new
{
Uri = new Uri("http://localhost:80/abc?a=5"),
Null = (object?)null,
Guid = _guid,
Float = 10.0f,
Double = Math.E,
Check = true,
Child = new
{
ChildInteger = 4,
ChildDateTime = new DateTime(2018, 2, 17),
ChildTimeSpan = TimeSpan.FromMilliseconds(999)
},
Integer = 9,
Long = long.MaxValue,
String = "test",
Char = 'c',
Bytes = _bytes,
Array = new[] { "a1" },
ListT = new List<int> { 1 },
IList = (IList)new List<int> { 1 },
IEnumerableT = (IEnumerable<string>)new[] { "s" },
IEnumerable = (IEnumerable)new[] { "s" }
};
Call ToJsonSchema
var schema = instance.ToJsonSchema().ToJson(Formatting.Indented).Replace(" ", " ");
Generated Swagger Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"Uri": {
"type": "string",
"format": "uri"
},
"Null": {
"type": "null"
},
"Guid": {
"type": "string",
"format": "guid"
},
"Float": {
"type": "number",
"format": "float"
},
"Double": {
"type": "number",
"format": "double"
},
"Check": {
"type": "boolean"
},
"Child": {
"type": "object",
"properties": {
"ChildInteger": {
"type": "integer",
"format": "int32"
},
"ChildDateTime": {
"type": "string",
"format": "date-time"
},
"ChildTimeSpan": {
"type": "string",
"format": "time-span"
}
}
},
"Integer": {
"type": "integer",
"format": "int32"
},
"Long": {
"type": "integer",
"format": "int64"
},
"String": {
"type": "string"
},
"Char": {
"type": "object"
},
"Bytes": {
"type": "array",
"items": {
"type": "string",
"format": "byte"
}
},
"Array": {
"type": "array",
"items": {
"type": "string"
}
},
"ListT": {
"type": "array",
"items": [
{
"type": "integer",
"format": "int32"
}
]
},
"IList": {
"type": "array",
"items": [
{
"type": "integer",
"format": "int32"
}
]
},
"IEnumerableT": {
"type": "array",
"items": {
"type": "string"
}
},
"IEnumerable": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
Sponsors
Entity Framework Extensions and Dapper Plus are major sponsors and proud to contribute to the development of NJsonSchema.Extensions.
Product | Versions 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
.NET Core | netcoreapp1.0 was computed. netcoreapp1.1 was computed. netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard1.3 is compatible. netstandard1.4 was computed. netstandard1.5 was computed. netstandard1.6 was computed. netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net40 is compatible. net403 was computed. net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen30 was computed. tizen40 was computed. tizen60 was computed. |
Universal Windows Platform | uap was computed. uap10.0 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.
-
.NETFramework 4.0
- NJsonSchema (>= 10.9.0)
-
.NETFramework 4.5
- NJsonSchema (>= 10.9.0)
-
.NETStandard 1.3
- NETStandard.Library (>= 1.6.1)
- NJsonSchema (>= 10.9.0)
- System.Reflection.TypeExtensions (>= 4.7.0)
-
.NETStandard 2.0
- NJsonSchema (>= 10.9.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on NJsonSchema.Extensions:
Package | Downloads |
---|---|
WireMock.Net.Minimal
Minimal version from the lightweight Http Mocking Server for .NET |
GitHub repositories (2)
Showing the top 2 popular GitHub repositories that depend on NJsonSchema.Extensions:
Repository | Stars |
---|---|
chocolatey/choco
Chocolatey - the package manager for Windows
|
|
wiremock/WireMock.Net
WireMock.Net is a flexible product for stubbing and mocking web HTTP responses using advanced request matching and response templating. Based on the functionality from http://WireMock.org, but extended with more functionality.
|
# 0.2.0 (18 June 2025)
- #2 Upgrade some packages [enhancement]
The full release notes can be found here: https://github.com/StefH/NJsonSchema.Extensions/blob/main/ReleaseNotes.md