Partial implementation of scheme for terms #290.
This commit is contained in:
parent
a692db85cb
commit
d49b3b1026
|
@ -587,7 +587,6 @@ class REST_Metadata_Controller extends REST_Controller {
|
|||
return $endpoint_args;
|
||||
}
|
||||
|
||||
|
||||
function get_schema() {
|
||||
$schema = [
|
||||
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
||||
|
|
|
@ -45,7 +45,8 @@ class REST_Terms_Controller extends REST_Controller {
|
|||
'callback' => array($this, 'get_items'),
|
||||
'permission_callback' => array($this, 'get_items_permissions_check'),
|
||||
'args' => $this->get_wp_query_params()
|
||||
)
|
||||
),
|
||||
'schema' => [$this, 'get_schema']
|
||||
)
|
||||
);
|
||||
register_rest_route($this->namespace,'/taxonomy/(?P<taxonomy_id>[\d]+)/'. $this->rest_base . '/(?P<term_id>[\d]+)' ,
|
||||
|
@ -71,7 +72,8 @@ class REST_Terms_Controller extends REST_Controller {
|
|||
'callback' => array($this, 'get_item'),
|
||||
'permission_callback' => array($this, 'get_item_permissions_check'),
|
||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::READABLE)
|
||||
)
|
||||
),
|
||||
'schema' => [$this, 'get_schema']
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -463,6 +465,28 @@ class REST_Terms_Controller extends REST_Controller {
|
|||
|
||||
return $query_params;
|
||||
}
|
||||
|
||||
function get_schema() {
|
||||
$schema = [
|
||||
'$schema' => 'http://json-schema.org/draft-04/schema#',
|
||||
'title' => 'term',
|
||||
'type' => 'object'
|
||||
];
|
||||
|
||||
$main_schema = parent::get_repository_schema( $this->terms_repository );
|
||||
$permissions_schema = parent::get_permissions_schema();
|
||||
|
||||
// $taxonomy_scheme = parent::get_repository_schema( $this->taxonomy_repository );
|
||||
|
||||
$schema['properties'] = array_merge(
|
||||
parent::get_base_properties_schema(),
|
||||
$main_schema,
|
||||
$permissions_schema
|
||||
// $taxonomy_scheme
|
||||
);
|
||||
|
||||
return $schema;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in New Issue