Files

38 lines
1.4 KiB
PHP
Raw Permalink Normal View History

2026-10-05 18:10:18 -04:00
<?php
declare(strict_types=1);
namespace Pterodactyl\Extensions\Scribe\Attributes;
use Attribute;
use Knuckles\Scribe\Attributes\ResponseField as BaseResponseField;
/**
2026-10-11 22:11:08 -04:00
* Declares schema metadata for one field of an API resource's attributes, placed on
* the resource class itself so the OpenAPI schema stays next to the code
2026-10-05 18:10:18 -04:00
* that produces the field. Field names are relative to the attributes object
* and may use dot paths (e.g. "feature_limits.databases").
*/
#[Attribute(Attribute::IS_REPEATABLE | Attribute::TARGET_FUNCTION | Attribute::TARGET_METHOD | Attribute::TARGET_CLASS)]
class ResponseField extends BaseResponseField
{
/**
2026-10-11 19:33:49 -04:00
* @param array<string, mixed> $schema Raw OpenAPI schema fragment replacing the inferred
* one - for shapes the simple parameters cannot
* express (additionalProperties maps, oneOf unions).
2026-10-05 18:10:18 -04:00
*/
public function __construct(
string $name,
?string $type = null,
?string $description = '',
?bool $required = true,
mixed $example = null,
mixed $enum = null,
?bool $nullable = false,
?bool $deprecated = false,
public array $schema = [],
) {
parent::__construct($name, $type, $description, $required, $example, $enum, $nullable, $deprecated);
}
}