Class JsonSchemaTypeAttribute

Namespace
Cratis.Chronicle.Schemas
Assembly
Cratis.Chronicle.dll

Attribute used to override the type a type is represented as in the generated JSON schema.

[AttributeUsage(AttributeTargets.Class|AttributeTargets.Struct)]
public sealed class JsonSchemaTypeAttribute : Attribute
Inheritance
JsonSchemaTypeAttribute
Inherited Members
Extension Methods

Remarks

Initializes a new instance of the JsonSchemaTypeAttribute class.

A type that brings its own JsonConverter serializes to something other than its own shape — a value object written as a single string, for instance. The generated schema is what Chronicle stores and reads values against, so it has to describe what actually goes on the wire; without this the schema would describe the CLR shape and the value would not round-trip. Adorn the type with this attribute to state what its converter actually produces, rather than depending on attributes from whichever schema library is in use.

Constructors

JsonSchemaTypeAttribute(Type)

Attribute used to override the type a type is represented as in the generated JSON schema.

public JsonSchemaTypeAttribute(Type type)

Parameters

type Type

The Type the adorned type is represented as in the JSON schema.

Remarks

Initializes a new instance of the JsonSchemaTypeAttribute class.

A type that brings its own JsonConverter serializes to something other than its own shape — a value object written as a single string, for instance. The generated schema is what Chronicle stores and reads values against, so it has to describe what actually goes on the wire; without this the schema would describe the CLR shape and the value would not round-trip. Adorn the type with this attribute to state what its converter actually produces, rather than depending on attributes from whichever schema library is in use.

Properties

Type

Gets the Type the adorned type is represented as in the JSON schema.

public Type Type { get; }

Property Value

Type