Class SchemaDependency
Creates a dependency that is based on a secondary schema.
Inheritance
Inherited Members
Namespace: Manatee.Json.Schema
Assembly: Manatee.Json.dll
Syntax
public class SchemaDependency : IJsonSchemaDependency, IJsonSerializable, IEquatable<IJsonSchemaDependency>, IEquatable<SchemaDependency>
Constructors
| Improve this Doc View SourceSchemaDependency(String, JsonSchema)
Creates a new instance of the SchemaDependency class.
Declaration
public SchemaDependency(string propertyName, JsonSchema schema)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName | The property name. |
JsonSchema | schema | The schema which must be validated. |
Properties
| Improve this Doc View SourceErrorTemplate
Gets or sets the error message template.
Declaration
public static string ErrorTemplate { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
Does not supports any tokens.
PropertyName
Gets or sets the property with the dependency.
Declaration
public string PropertyName { get; }
Property Value
Type | Description |
---|---|
System.String |
SupportedVersions
Gets the versions (drafts) of JSON Schema which support this keyword.
Declaration
public JsonSchemaVersion SupportedVersions { get; }
Property Value
Type | Description |
---|---|
JsonSchemaVersion |
Methods
| Improve this Doc View SourceEquals(Nullable<IJsonSchemaDependency>)
Indicates whether the current object is equal to another object of the same type.
Declaration
public bool Equals(IJsonSchemaDependency? other)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<IJsonSchemaDependency> | other | An object to compare with this object. |
Returns
Type | Description |
---|---|
System.Boolean | true if the current object is equal to the |
Equals(Nullable<SchemaDependency>)
Indicates whether the current object is equal to another object of the same type.
Declaration
public bool Equals(SchemaDependency? other)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<SchemaDependency> | other | An object to compare with this object. |
Returns
Type | Description |
---|---|
System.Boolean | true if the current object is equal to the |
Equals(Nullable<Object>)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object? obj)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Object> | obj | The object to compare with the current object. |
Returns
Type | Description |
---|---|
System.Boolean | true if the specified object is equal to the current object; otherwise, false. |
FromJson(JsonValue, JsonSerializer)
Builds an object from a JsonValue.
Declaration
public void FromJson(JsonValue json, JsonSerializer serializer)
Parameters
Type | Name | Description |
---|---|---|
JsonValue | json | The JsonValue representation of the object. |
JsonSerializer | serializer | The JsonSerializer instance to use for additional serialization of values. |
GetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | A hash code for the current object. |
Overrides
RegisterSubschemas(SchemaValidationContext)
Used register any subschemas during validation. Enables look-forward compatibility with $ref
keywords.
Declaration
public void RegisterSubschemas(SchemaValidationContext context)
Parameters
Type | Name | Description |
---|---|---|
SchemaValidationContext | context | The context object. |
ResolveSubschema(JsonPointer, Uri, JsonSchemaVersion)
Resolves any subschemas during resolution of a $ref
during validation.
Declaration
public JsonSchema? ResolveSubschema(JsonPointer pointer, Uri baseUri, JsonSchemaVersion supportedVersions)
Parameters
Type | Name | Description |
---|---|---|
JsonPointer | pointer | A JsonPointer to the target schema. |
System.Uri | baseUri | The current base URI. |
JsonSchemaVersion | supportedVersions | Indicates the root schema's supported versions. |
Returns
Type | Description |
---|---|
System.Nullable<JsonSchema> | The referenced schema, if it exists; otherwise null. |
ToJson(JsonSerializer)
Converts an object to a JsonValue.
Declaration
public JsonValue ToJson(JsonSerializer serializer)
Parameters
Type | Name | Description |
---|---|---|
JsonSerializer | serializer | The JsonSerializer instance to use for additional serialization of values. |
Returns
Type | Description |
---|---|
JsonValue | The JsonValue representation of the object. |
Validate(SchemaValidationContext)
Provides the validation logic for this dependency.
Declaration
public SchemaValidationResults Validate(SchemaValidationContext context)
Parameters
Type | Name | Description |
---|---|---|
SchemaValidationContext | context | The context object. |
Returns
Type | Description |
---|---|
SchemaValidationResults | Results object containing a final result and any errors that may have been found. |