Show / Hide Table of Contents

Class Schema

Class Schema represents a JSON Type Definition schema.

Inheritance
System.Object
Schema
Namespace: Jtd.Jtd
Assembly: Jtd.Jtd.dll
Syntax
public class Schema : object
Remarks

This class is designed to be usable as a serializable (and deserializable) class for use with Newtonsoft.Json.JsonConvert or System.Text.Json.JsonSerializer.

The correctness of a JSON Type Definition schema cannot be expressed entirely within CSharp's type system. To that end, consider using Verify() to ensure that a Schema represents a correct JSON Type Definition schema.

Properties

| Improve this Doc View Source

AdditionalProperties

Declaration
public bool? AdditionalProperties { get; set; }
Property Value
Type Description
System.Nullable<System.Boolean>

Corresponds to the additionalProperties keyword in JSON Type Definition.

| Improve this Doc View Source

Definitions

Declaration
public IDictionary<string, Schema> Definitions { get; set; }
Property Value
Type Description
IDictionary<System.String, Schema>

Corresponds to the definitions keyword in JSON Type Definition.

| Improve this Doc View Source

Discriminator

Declaration
public string Discriminator { get; set; }
Property Value
Type Description
System.String

Corresponds to the discriminator keyword in JSON Type Definition.

| Improve this Doc View Source

Elements

Declaration
public Schema Elements { get; set; }
Property Value
Type Description
Schema

Corresponds to the elements keyword in JSON Type Definition.

| Improve this Doc View Source

Enum

Declaration
public ISet<string> Enum { get; set; }
Property Value
Type Description
ISet<System.String>

Corresponds to the enum keyword in JSON Type Definition.

| Improve this Doc View Source

Mapping

Declaration
public IDictionary<string, Schema> Mapping { get; set; }
Property Value
Type Description
IDictionary<System.String, Schema>

Corresponds to the mapping keyword in JSON Type Definition.

| Improve this Doc View Source

Metadata

Declaration
public IDictionary<string, object> Metadata { get; set; }
Property Value
Type Description
IDictionary<System.String, System.Object>

Corresponds to the metadata keyword in JSON Type Definition.

| Improve this Doc View Source

Nullable

Declaration
public bool? Nullable { get; set; }
Property Value
Type Description
System.Nullable<System.Boolean>

Corresponds to the nullable keyword in JSON Type Definition.

| Improve this Doc View Source

OptionalProperties

Declaration
public IDictionary<string, Schema> OptionalProperties { get; set; }
Property Value
Type Description
IDictionary<System.String, Schema>

Corresponds to the optionalProperties keyword in JSON Type Definition.

| Improve this Doc View Source

Properties

Declaration
public IDictionary<string, Schema> Properties { get; set; }
Property Value
Type Description
IDictionary<System.String, Schema>

Corresponds to the properties keyword in JSON Type Definition.

| Improve this Doc View Source

Ref

Declaration
public string Ref { get; set; }
Property Value
Type Description
System.String

Corresponds to the ref keyword in JSON Type Definition.

| Improve this Doc View Source

Type

Declaration
public Type? Type { get; set; }
Property Value
Type Description
System.Nullable<Type>

Corresponds to the type keyword in JSON Type Definition.

| Improve this Doc View Source

Values

Declaration
public Schema Values { get; set; }
Property Value
Type Description
Schema

Corresponds to the values keyword in JSON Type Definition.

Methods

| Improve this Doc View Source

Form()

Determines the form the Schema takes on.

Declaration
public Form Form()
Returns
Type Description
Form

The form the schema takes on, assuming it is a correct schema.

Remarks

The JSON Type Definition specification requires that all schemas take on a particular "form", which is essentially a particular combination of keywords. This method determines which form a schema is using.

The return value of this method is meaningful only if the schema is, or is a sub-schema of, a correct schema. In other words, calling Verify() on this schema's root schema must not have raised an exception.

| Improve this Doc View Source

Verify()

Verifies that the Schema represents a correct JSON Type Definition schema.

Declaration
public void Verify()
Remarks

The JSON Type Definition specification has certain requirements on correct schemas that cannot be represented in CSharp's type system, such as requiring that all ref keywords have a corresponding definition. This method will check each of these requirements.

Exceptions
Type Condition
InvalidSchemaException

If the schema is not correct.

  • Improve this Doc
  • View Source
Back to top Generated by DocFX