class

Gemini::Schema

Inherits JSON::Serializable < Reference < Object

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

Constructors

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)
Source
new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source

Instance methods

description

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

Source
description=(description : String | Nil)

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

Source
enumeration

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)

Source
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)

Source
format

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

  • NUMBER: float, double
  • INTEGER: int32, int64
  • STRING: enum
Source
format=(format : String | Nil)

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

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

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

Source
items=(items : Schema | Nil)

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

Source
max_items

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

Source
max_items=(max_items : String | Nil)

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

Source
min_items

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

Source
min_items=(min_items : String | Nil)

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

Source
nullable=(nullable : Bool | Nil)

Indicates if the value may be null. (Optional)

Source
nullable?

Indicates if the value may be null. (Optional)

Source
properties

Properties of Type. (Optional)

Source
properties=(properties : Hash(String, Schema) | Nil)

Properties of Type. (Optional)

Source
required

Required properties of Type. (Optional)

Source
required=(required : Array(String) | Nil)

Required properties of Type. (Optional)

Source
type

Data type. (Required)

Source
type=(type : Type)

Data type. (Required)

Source

Nested types