API Models TypeDefinition - evansims/openfga-php GitHub Wiki
Represents a type definition in your authorization model. A TypeDefinition defines an object type (like "document," "folder," "user") and specifies the relations that can exist for objects of this type. Each relation defines how users can be related to objects, such as "owner," "editor," or "viewer" relationships. Use this when defining the schema of object types and their allowed relationships in your authorization model.
Table of Contents
OpenFGA\Models
TypeDefinitionInterface
JsonSerializable
ModelInterface
- TypeDefinitionInterface (interface)
- TypeDefinitions (collection)
Name | Value | Description |
---|---|---|
OPENAPI_MODEL |
TypeDefinition |
public function getMetadata(): ?OpenFGA\Models\MetadataInterface
Get the metadata associated with this type definition. Metadata provides additional context, documentation, and configuration information for the type definition. This can include source file information, module details, and other development-time context.
MetadataInterface
| null
— The metadata, or null if not specified
public function getRelations(): ?OpenFGA\Models\Collections\TypeDefinitionRelationsInterface
Get the collection of relations defined for this type. Relations define the authorized relationships that can exist between objects of this type and other entities in the system.
TypeDefinitionRelationsInterface
| null
public function getType(): string
Get the name of this type. The type name uniquely identifies this type definition within the authorization model. Common examples include "user," "document," "folder," "organization," etc.
string
— The unique type name
public function jsonSerialize(): array
array
Implements Models\TypeDefinitionInterface
public function schema(): SchemaInterface
Get the schema definition for this model. This method returns the schema that defines the structure, validation rules, and serialization behavior for this model class. The schema is used for data validation, transformation, and ensuring consistency across API operations with the OpenFGA service. Each model's schema defines: - Required and optional properties - Data types and format constraints - Nested object relationships - Validation rules and business logic constraints The schema system enables the SDK to automatically validate incoming data, transform between different representations, and ensure compliance with the OpenFGA API specification.
SchemaInterface
— The schema definition containing validation rules and property specifications for this model