class Gemini::Schema

Overview

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.

API Reference

Included Modules

Defined in:

gemini/types.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(pull : JSON::PullParser) #

def self.new(type : Gemini::Schema::Type, format : Nil | String = nil, description : Nil | String = nil, nullable : Bool | Nil = nil, enumeration : Nil | Array(String) = nil, max_items : Nil | String = nil, min_items : Nil | String = nil, properties : Nil | Hash(String, Gemini::Schema) = nil, required : Nil | Array(String) = nil, items : Nil | Gemini::Schema = nil) #

Instance Method Detail

def description : String | Nil #

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


def description=(description : String | Nil) #

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


def enumeration : Array(String) | Nil #

Possible values of the element of Type::String with enum format. For example we can define an Enum Direction as:

Schema.new(
  type: :string,
  format: "enum",
  enumeration: ["EAST", "NORTH", "SOUTH", "WEST"]
)

(Optional)


def enumeration=(enumeration : Array(String) | Nil) #

Possible values of the element of Type::String with enum format. For example we can define an Enum Direction as:

Schema.new(
  type: :string,
  format: "enum",
  enumeration: ["EAST", "NORTH", "SOUTH", "WEST"]
)

(Optional)


def format : String | Nil #

The format of the data. (Optional) Supported formats:

  • NUMBER: float, double
  • INTEGER: int32, int64
  • STRING: enum

def format=(format : String | Nil) #

The format of the data. (Optional) Supported formats:

  • NUMBER: float, double
  • INTEGER: int32, int64
  • STRING: enum

def items : Schema | Nil #

Schema of the elements of Type::Array. (Optional)


def items=(items : Schema | Nil) #

Schema of the elements of Type::Array. (Optional)


def max_items : String | Nil #

Maximum number of the elements for Type::Array. (Optional)


def max_items=(max_items : String | Nil) #

Maximum number of the elements for Type::Array. (Optional)


def min_items : String | Nil #

Minimum number of the elements for Type::Array. (Optional)


def min_items=(min_items : String | Nil) #

Minimum number of the elements for Type::Array. (Optional)


def nullable=(nullable : Bool | Nil) #

Indicates if the value may be null. (Optional)


def nullable? : Bool | Nil #

Indicates if the value may be null. (Optional)


def properties : Hash(String, Schema) | Nil #

Properties of Type. (Optional)


def properties=(properties : Hash(String, Schema) | Nil) #

Properties of Type. (Optional)


def required : Array(String) | Nil #

Required properties of Type. (Optional)


def required=(required : Array(String) | Nil) #

Required properties of Type. (Optional)


def type : Type #

Data type. (Required)


def type=(type : Type) #

Data type. (Required)