WP_REST_Abilities_V1_List_Controller::get_item_schemapublicWP 6.9.0

Retrieves the ability's schema, conforming to JSON Schema.

Method of the class: WP_REST_Abilities_V1_List_Controller{}

No Hooks.

Returns

Array. mixed> Item schema data.

Usage

$WP_REST_Abilities_V1_List_Controller = new WP_REST_Abilities_V1_List_Controller();
$WP_REST_Abilities_V1_List_Controller->get_item_schema(): array;

Changelog

Since 6.9.0 Introduced.

WP_REST_Abilities_V1_List_Controller::get_item_schema() code WP 6.9

public function get_item_schema(): array {
	$schema = array(
		'$schema'    => 'http://json-schema.org/draft-04/schema#',
		'title'      => 'ability',
		'type'       => 'object',
		'properties' => array(
			'name'          => array(
				'description' => __( 'Unique identifier for the ability.' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit', 'embed' ),
				'readonly'    => true,
			),
			'label'         => array(
				'description' => __( 'Display label for the ability.' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit', 'embed' ),
				'readonly'    => true,
			),
			'description'   => array(
				'description' => __( 'Description of the ability.' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'category'      => array(
				'description' => __( 'Ability category this ability belongs to.' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit', 'embed' ),
				'readonly'    => true,
			),
			'input_schema'  => array(
				'description' => __( 'JSON Schema for the ability input.' ),
				'type'        => 'object',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'output_schema' => array(
				'description' => __( 'JSON Schema for the ability output.' ),
				'type'        => 'object',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'meta'          => array(
				'description' => __( 'Meta information about the ability.' ),
				'type'        => 'object',
				'properties'  => array(
					'annotations' => array(
						'description' => __( 'Annotations for the ability.' ),
						'type'        => array( 'boolean', 'null' ),
						'default'     => null,
					),
				),
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
		),
	);

	return $this->add_additional_fields_schema( $schema );
}