Search Results for

    Show / Hide Table of Contents

    Class JsonSchema

    The Schema object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. Represents a select subset of an OpenAPI 3.0 schema object.

    Inheritance
    object
    JsonSchema
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Glitch9.IO.Json.Schema
    Assembly: Glitch9.IO.dll
    Syntax
    public sealed class JsonSchema

    Properties

    | Edit this page View Source

    AnyOf

    Optional. The value should be validated against any (one or more) of the subschemas in the list.

    Declaration
    public List<JsonSchema> AnyOf { get; set; }
    Property Value
    Type Description
    List<JsonSchema>
    | Edit this page View Source

    Description

    Optional. A brief description of the parameter. This could contain examples of use. Parameter description may be formatted as Markdown.

    Declaration
    public string Description { get; set; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    Enum

    Optional. Possible values of the element of Type.STRING with enum format. For example we can define an Enum Direction as : {type:STRING, format:enum, enum:["EAST", NORTH", "SOUTH", "WEST"]}

    Declaration
    public List<string> Enum { get; set; }
    Property Value
    Type Description
    List<string>
    | Edit this page View Source

    Extras

    Optional.

    Declaration
    [JsonIgnore]
    public Dictionary<string, object> Extras { get; set; }
    Property Value
    Type Description
    Dictionary<string, object>
    | Edit this page View Source

    Format

    Optional. The format of the data. This is used only for primitive data types.

    OpenAI Supported formats: string only.

    Google Generative AI Supported formats: for NUMBER type: float, double for INTEGER type: int32, int64

    Declaration
    public string Format { get; set; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    Items

    Optional. Schema of the elements of Type.ARRAY.

    Declaration
    public JsonSchema Items { get; set; }
    Property Value
    Type Description
    JsonSchema
    | Edit this page View Source

    MaxItems

    Optional. Maximum number of the elements for Type.ARRAY.

    Declaration
    public int? MaxItems { get; set; }
    Property Value
    Type Description
    int?
    | Edit this page View Source

    Maximum

    Declaration
    public int? Maximum { get; set; }
    Property Value
    Type Description
    int?
    | Edit this page View Source

    MinItems

    Optional. Minimum number of the elements for Type.ARRAY.

    Declaration
    public int? MinItems { get; set; }
    Property Value
    Type Description
    int?
    | Edit this page View Source

    Minimum

    Declaration
    public int? Minimum { get; set; }
    Property Value
    Type Description
    int?
    | Edit this page View Source

    Name

    Declaration
    [JsonIgnore]
    public string Name { get; set; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    Nullable

    Optional. Indicates if the value may be null.

    Declaration
    public bool? Nullable { get; set; }
    Property Value
    Type Description
    bool?
    | Edit this page View Source

    Properties

    map (key: string, value: object (Schema)) Optional. Properties of Type.OBJECT. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

    Declaration
    public Dictionary<string, JsonSchema> Properties { get; set; }
    Property Value
    Type Description
    Dictionary<string, JsonSchema>
    | Edit this page View Source

    Required

    Optional. Required properties of Type.OBJECT.

    Declaration
    public List<string> Required { get; set; }
    Property Value
    Type Description
    List<string>
    | Edit this page View Source

    Title

    Optional. The title of the schema.

    Declaration
    public string Title { get; set; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    Type

    Required. Data type.

    Declaration
    public JsonSchemaType Type { get; set; }
    Property Value
    Type Description
    JsonSchemaType

    Methods

    | Edit this page View Source

    AddParameter(string, JsonSchema)

    Declaration
    public void AddParameter(string name, JsonSchema jsonSchema)
    Parameters
    Type Name Description
    string name
    JsonSchema jsonSchema
    | Edit this page View Source

    Create(Type, JsonSchemaPropertyAttribute)

    Declaration
    public static JsonSchema Create(Type type, JsonSchemaPropertyAttribute propertyAttribute = null)
    Parameters
    Type Name Description
    Type type
    JsonSchemaPropertyAttribute propertyAttribute
    Returns
    Type Description
    JsonSchema
    | Edit this page View Source

    Create<T>(JsonSchemaPropertyAttribute)

    Declaration
    public static JsonSchema Create<T>(JsonSchemaPropertyAttribute propertyAttribute = null)
    Parameters
    Type Name Description
    JsonSchemaPropertyAttribute propertyAttribute
    Returns
    Type Description
    JsonSchema
    Type Parameters
    Name Description
    T
    | Edit this page View Source

    GetName()

    Declaration
    public string GetName()
    Returns
    Type Description
    string
    | Edit this page View Source

    Read(JsonReader)

    Declaration
    public static JsonSchema Read(JsonReader reader)
    Parameters
    Type Name Description
    JsonReader reader
    Returns
    Type Description
    JsonSchema
    | Edit this page View Source

    ToString(TextCase)

    Declaration
    public string ToString(TextCase typeStringCase = TextCase.SnakeCase)
    Parameters
    Type Name Description
    TextCase typeStringCase
    Returns
    Type Description
    string
    | Edit this page View Source

    WriteTo(JsonWriter, TextCase, bool)

    Declaration
    public void WriteTo(JsonWriter writer, TextCase typeStringCase = TextCase.SnakeCase, bool includeExtras = true)
    Parameters
    Type Name Description
    JsonWriter writer
    TextCase typeStringCase
    bool includeExtras

    Extension Methods

    ArrayExtensions.ToArrayOrEmpty<T>(T)
    ArrayExtensions.ToArrayOrNull<T>(T)
    EventExtensions.ToDelta<T>(T, string, int, string, bool)
    EventExtensions.ToDone<T>(T, string, int, string)
    EventExtensions.ToEvent<T>(T)
    EventExtensions.UpcastDelta<T1, T2>(T1, string, int, string, bool)
    FallbackExtensions.IsOr<TParent, TChild>(TParent, TChild)
    JsonSchemaPropertyExtensions.ToJsonSchemaProperty(JsonSchema, bool)
    ResponseCastingExtensions.GetResult<T>(T)
    SystemExtensions.GetName(object)
    • Edit this page
    • View Source
    In this article
    Back to top AI DevKit Documentation