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.
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
|
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
|
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
|
Edit this page
View Source
Declaration
[JsonIgnore]
public Dictionary<string, object> Extras { get; set; }
Property Value
|
Edit this page
View Source
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
|
Edit this page
View Source
Items
Optional.
Schema of the elements of Type.ARRAY.
Declaration
public JsonSchema Items { get; set; }
Property Value
|
Edit this page
View Source
MaxItems
Optional. Maximum number of the elements for Type.ARRAY.
Declaration
public int? MaxItems { get; set; }
Property Value
|
Edit this page
View Source
Maximum
Declaration
public int? Maximum { get; set; }
Property Value
|
Edit this page
View Source
MinItems
Optional. Minimum number of the elements for Type.ARRAY.
Declaration
public int? MinItems { get; set; }
Property Value
|
Edit this page
View Source
Minimum
Declaration
public int? Minimum { get; set; }
Property Value
|
Edit this page
View Source
Name
Declaration
[JsonIgnore]
public string Name { get; set; }
Property Value
|
Edit this page
View Source
Nullable
Optional.
Indicates if the value may be null.
Declaration
public bool? Nullable { get; set; }
Property Value
|
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
|
Edit this page
View Source
Required
Optional.
Required properties of Type.OBJECT.
Declaration
public List<string> Required { get; set; }
Property Value
|
Edit this page
View Source
Title
Optional. The title of the schema.
Declaration
public string Title { get; set; }
Property Value
|
Edit this page
View Source
Type
Declaration
public JsonSchemaType Type { get; set; }
Property Value
Methods
|
Edit this page
View Source
AddParameter(string, JsonSchema)
Declaration
public void AddParameter(string name, JsonSchema jsonSchema)
Parameters
|
Edit this page
View Source
Create(Type, JsonSchemaPropertyAttribute)
Declaration
public static JsonSchema Create(Type type, JsonSchemaPropertyAttribute propertyAttribute = null)
Parameters
Returns
|
Edit this page
View Source
Create<T>(JsonSchemaPropertyAttribute)
Declaration
public static JsonSchema Create<T>(JsonSchemaPropertyAttribute propertyAttribute = null)
Parameters
Returns
Type Parameters
|
Edit this page
View Source
GetName()
Declaration
Returns
|
Edit this page
View Source
Read(JsonReader)
Declaration
public static JsonSchema Read(JsonReader reader)
Parameters
| Type |
Name |
Description |
| JsonReader |
reader |
|
Returns
|
Edit this page
View Source
ToString(TextCase)
Declaration
public string ToString(TextCase typeStringCase = TextCase.SnakeCase)
Parameters
| Type |
Name |
Description |
| TextCase |
typeStringCase |
|
Returns
|
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