class ObjectType extends Type (View source)

Properties

protected bool|null $required

Whether the type is required.

from  Type
protected string|null $title

The type's title.

from  Type
protected string|null $description

The type's description.

from  Type
protected mixed $default

The default value for the type.

from  Type
protected array<int, mixed>|null $enum

The set of allowed values for the type.

from  Type
protected bool|null $nullable

Indicates if the type is nullable.

from  Type
protected bool|null $additionalProperties

Whether additional properties are allowed.

Methods

static Type
fromArray(array $schema)

Build a type from a raw array of the Laravel-supported JSON Schema subset.

static Type
__callStatic(string $name, mixed $arguments)

Dynamically pass static methods to the schema instance.

static ObjectType
object(Closure|array<string $, Type> $properties = '[]')

No description

static AnyOfType
anyOf(Closure|array<int $, Type> $schemas)

No description

static IntegerType
integer()

No description

static NumberType
number()

No description

static StringType
string()

No description

static BooleanType
boolean()

No description

static ArrayType
array()

No description

static UnionType
union(array<int $, string> $types)

No description

required(bool $required = true)

Indicate that the type is required.

from  Type
nullable(bool $nullable = true)

Indicate that the type is optional.

from  Type
title(string $value)

Set the type's title.

from  Type
description(string $value)

Set the type's description.

from  Type
enum(array|string $values)

Restrict the value to one of the provided enumerated values.

from  Type
array
toArray()

Convert the type to an array.

from  Type
string
toString()

Convert the type to its string representation.

from  Type
string
__toString()

Convert the type to its string representation.

from  Type
__construct(array $properties = [])

Create a new object type instance.

withoutAdditionalProperties()

Disallow additional properties.

default(array $value)

Set the type's default value.

Details

static Type fromArray(array $schema)

Build a type from a raw array of the Laravel-supported JSON Schema subset.

Parameters

array $schema

Return Value

Type

Exceptions

InvalidArgumentException

static Type __callStatic(string $name, mixed $arguments)

Dynamically pass static methods to the schema instance.

Parameters

string $name
mixed $arguments

Return Value

Type

static ObjectType object(Closure|array<string $, Type> $properties = '[]')

No description

Parameters

Closure|array<string $
Type> $properties

Return Value

ObjectType

static AnyOfType anyOf(Closure|array<int $, Type> $schemas)

No description

Parameters

Closure|array<int $
Type> $schemas

Return Value

AnyOfType

static IntegerType integer()

No description

Return Value

IntegerType

static NumberType number()

No description

Return Value

NumberType

static StringType string()

No description

Return Value

StringType

static BooleanType boolean()

No description

Return Value

BooleanType

static ArrayType array()

No description

Return Value

ArrayType

static UnionType union(array<int $, string> $types)

No description

Parameters

array<int $
string> $types

Return Value

UnionType

Type required(bool $required = true)

Indicate that the type is required.

Parameters

bool $required

Return Value

Type

Type nullable(bool $nullable = true)

Indicate that the type is optional.

Parameters

bool $nullable

Return Value

Type

Type title(string $value)

Set the type's title.

Parameters

string $value

Return Value

Type

Type description(string $value)

Set the type's description.

Parameters

string $value

Return Value

Type

Type enum(array|string $values)

Restrict the value to one of the provided enumerated values.

Parameters

array|string $values

Return Value

Type

Exceptions

InvalidArgumentException

array toArray()

Convert the type to an array.

Return Value

array

string toString()

Convert the type to its string representation.

Return Value

string

string __toString()

Convert the type to its string representation.

Return Value

string

__construct(array $properties = [])

Create a new object type instance.

Parameters

array $properties

ObjectType withoutAdditionalProperties()

Disallow additional properties.

Return Value

ObjectType

ObjectType default(array $value)

Set the type's default value.

Parameters

array $value

Return Value

ObjectType

Laravel Cloud is the best place to deploy Laravel, Nuxt, Express, Hono, Node.js, Bun, Go, Flask, Python, and more, with dedicated infrastructure available on AWS through Laravel Private Cloud.