Geminix.V1beta.Schema (geminix v0.2.0)

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.

Fields:

  • :any_of (list of Geminix.V1beta.Schema.t/0) - Optional. The value should be validated against any (one or more) of the subschemas in the list.
  • :default (any/0) - Optional. Default value of the field. Per JSON Schema, this field is intended for documentation generators and doesn't affect validation. Thus it's included here and ignored so that developers who send schemas with a default field don't get unknown-field errors.
  • :description (binary/0) - Optional. A brief description of the parameter. This could contain examples of use. Parameter description may be formatted as Markdown.
  • :enum (list of binary/0) - 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"]}
  • :example (any/0) - Optional. Example of the object. Will only populated when the object is the root.
  • :format (binary/0) - Optional. The format of the data. Any value is allowed, but most do not trigger any special functionality.
  • :items (Geminix.V1beta.Schema.t/0) - Optional. Schema of the elements of Type.ARRAY.
  • :max_items (binary/0) - Optional. Maximum number of the elements for Type.ARRAY.
  • :max_length (binary/0) - Optional. Maximum length of the Type.STRING
  • :max_properties (binary/0) - Optional. Maximum number of the properties for Type.OBJECT.
  • :maximum (number/0) - Optional. Maximum value of the Type.INTEGER and Type.NUMBER
  • :min_items (binary/0) - Optional. Minimum number of the elements for Type.ARRAY.
  • :min_length (binary/0) - Optional. SCHEMA FIELDS FOR TYPE STRING Minimum length of the Type.STRING
  • :min_properties (binary/0) - Optional. Minimum number of the properties for Type.OBJECT.
  • :minimum (number/0) - Optional. SCHEMA FIELDS FOR TYPE INTEGER and NUMBER Minimum value of the Type.INTEGER and Type.NUMBER
  • :nullable (boolean/0) - Optional. Indicates if the value may be null.
  • :pattern (binary/0) - Optional. Pattern of the Type.STRING to restrict a string to a regular expression.
  • :properties (map/0) - Optional. Properties of Type.OBJECT.
  • :property_ordering (list of binary/0) - Optional. The order of the properties. Not a standard field in open api spec. Used to determine the order of the properties in the response.
  • :required (list of binary/0) - Optional. Required properties of Type.OBJECT.
  • :title (binary/0) - Optional. The title of the schema.
  • :type (binary/0) - Required. Data type.

Summary

Functions

Create a Geminix.V1beta.Schema.t/0 from a map returned by the Gemini API.

Types

t()

@type t() :: %Geminix.V1beta.Schema{
  __meta__: term(),
  any_of: [t()],
  default: any(),
  description: binary(),
  enum: [binary()],
  example: any(),
  format: binary(),
  items: t(),
  max_items: binary(),
  max_length: binary(),
  max_properties: binary(),
  maximum: number(),
  min_items: binary(),
  min_length: binary(),
  min_properties: binary(),
  minimum: number(),
  nullable: boolean(),
  pattern: binary(),
  properties: map(),
  property_ordering: [binary()],
  required: [binary()],
  title: binary(),
  type: binary()
}

Functions

from_map(schema \\ %__MODULE__{}, map)

@spec from_map(t(), map()) :: {:ok, t()} | {:error, Ecto.Changeset.t()}

Create a Geminix.V1beta.Schema.t/0 from a map returned by the Gemini API.

Sometimes, this function should not be applied to the full response body, but instead it should be applied to the correct part of the map in the response body. This depends on the concrete API call.