API Schemas SchemaProperty - evansims/openfga-php GitHub Wiki

Represents a single property definition within a schema. This class defines the validation rules, type information, and metadata for individual properties of OpenFGA model objects. Each property specifies how a field should be validated, transformed, and mapped during object creation. Properties support various data types including primitives (string, int, bool), complex objects, arrays, and collections, with optional validation constraints such as required status, default values, format restrictions, and enumeration limits.

Table of Contents


Namespace

OpenFGA\Schemas


Source

View source code


Implements


Related Classes


Methods

getClassName

public function getClassName(): ?string

Get the fully qualified class name for object types.

View source


Returns

string | null


getDefault

public function getDefault(): mixed

Get the default value to use when property is missing.

View source


Returns

mixed — Default value for optional properties


getEnum

public function getEnum(): ?array

Get the array of allowed values for enumeration validation.

View source


Returns

array | null — Array of allowed values or null if not an enumeration


getFormat

public function getFormat(): ?string

Get the additional format constraint for this property.

View source


Returns

string | null — Format constraint (for example 'date', 'datetime') or null if none


getItems

public function getItems(): ?array

Get the type specification for array items.

View source


Returns

array | null


getName

public function getName(): string

Get the property name as it appears in the data.

View source


Returns

string — The property name


getParameterName

public function getParameterName(): ?string

Get the alternative parameter name for constructor mapping.

View source


Returns

string | null — Alternative parameter name or null if using default mapping


getType

public function getType(): string

Get the data type for this property.

View source


Returns

string — The data type (string, integer, boolean, array, object, etc.)


isRequired

public function isRequired(): bool

Check if this property is required for validation.

View source


Returns

bool — True if the property is required, false otherwise

⚠️ **GitHub.com Fallback** ⚠️