SharpSchema.Annotations
1.2.9-beta
dotnet add package SharpSchema.Annotations --version 1.2.9-beta
NuGet\Install-Package SharpSchema.Annotations -Version 1.2.9-beta
<PackageReference Include="SharpSchema.Annotations" Version="1.2.9-beta" />
paket add SharpSchema.Annotations --version 1.2.9-beta
#r "nuget: SharpSchema.Annotations, 1.2.9-beta"
// Install SharpSchema.Annotations as a Cake Addin #addin nuget:?package=SharpSchema.Annotations&version=1.2.9-beta&prerelease // Install SharpSchema.Annotations as a Cake Tool #tool nuget:?package=SharpSchema.Annotations&version=1.2.9-beta&prerelease
SharpSchema.Annotations
SharpSchema.Annotations is a .NET Standard 2.0 library that provides a set of attributes for controlling JSON Schema generation. It's part of the larger SharpSchema project, an opiniated solution for JSON Schema generation in .NET.
Features
- Schema Annotations: Define how your types are translated into JSON Schema with a rich set of attributes.
- Extensible Type Handling: Customize how different types are handled during schema generation.
- Source Package: To avoid referencing and shipping
SharpSchema.Annotations
in your project, include the source code directly in your project with theSharpSchema.Annotations.Source
package.
Getting Started
To install the package, you can use the following command in the Package Manager Console:
Install-Package SharpSchema.Annotations -Version 1.0.0
Or you can add the following PackageReference
to your .csproj
file:
<ItemGroup>
<PackageReference Include="SharpSchema.Annotations" Version="<package_version>" />
</ItemGroup>
Usage
After installing the package, you can use the provided attributes to control how your types are translated into JSON Schema. Here's an example:
using SharpSchema.Annotations;
[SchemaRoot(Id = "http://example.com/schemas/Person")]
public class Person
{
[SchemaMeta(Title = "First Name")]
public string FirstName { get; set; }
[SchemaMeta(Title = "Last Name")]
public string LastName { get; set; }
[SchemaIgnore]
public string InternalId { get; set; }
}
In this example, the Person
class will be translated into a JSON Schema with an ID of "http://example.com/schemas/Person". The FirstName
and LastName
properties will have titles in the schema, and the InternalId
property will be ignored.
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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | 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 | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on SharpSchema.Annotations:
Package | Downloads |
---|---|
SharpSchema
Core library for the SharpSchema project. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.2.9-beta | 48 | 1/7/2025 |
1.2.1-alpha | 70 | 1/6/2025 |
0.3.33-rc | 99 | 11/10/2024 |
0.3.32-rc | 55 | 11/3/2024 |
0.2.6-rc | 65 | 5/29/2024 |
0.1.602-rc | 66 | 5/28/2024 |