API Models RelationMetadata - evansims/openfga-php GitHub Wiki
Contains metadata information about a relation in your authorization model. RelationMetadata provides additional context about how a relation behaves, including which user types can be directly assigned to it and source information for debugging. This helps with model validation and provides insights into your authorization structure. Use this when you need to understand the constraints and properties of specific relations in your authorization model.
Table of Contents
OpenFGA\Models
RelationMetadataInterface
JsonSerializable
ModelInterface
- RelationMetadataInterface (interface)
Name | Value | Description |
---|---|---|
OPENAPI_MODEL |
RelationMetadata |
public function getDirectlyRelatedUserTypes(): ?OpenFGA\Models\Collections\RelationReferencesInterface
Get the user types that can be directly related through this relation. This defines which types of users can have this relation to objects, providing type safety and helping with authorization model validation. For example, a "member" relation might allow "user" and "group" types.
RelationReferencesInterface
| null
— The directly related user types, or null if not specified
public function getModule(): ?string
Get the optional module name for organization. This provides organizational information about which module or namespace contains the relation definition, helping with model organization and debugging.
string
| null
— The module name, or null if not specified
public function getSourceInfo(): ?OpenFGA\Models\SourceInfoInterface
Get optional source file information for debugging and tooling. This provides information about the source file where the relation was originally defined, which is useful for development tools, debugging, and error reporting.
SourceInfoInterface
| null
— The source file information, or null if not available
public function jsonSerialize(): array
array
Implements Models\RelationMetadataInterface
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