Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ public function prepare_item_for_response( $item, $request ) {
* @return array Item schema data.
*/
public function get_item_schema() {
if ( $this->schema ) {
return $this->add_additional_fields_schema( $this->schema );
}

$schema = array(
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => 'block-pattern-category',
Expand All @@ -151,6 +155,8 @@ public function get_item_schema() {
),
);

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

return $this->add_additional_fields_schema( $this->schema );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ public function prepare_item_for_response( $item, $request ) {
* @return array Item schema data.
*/
public function get_item_schema() {
if ( $this->schema ) {
return $this->add_additional_fields_schema( $this->schema );
}

$schema = array(
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => 'block-pattern',
Expand Down Expand Up @@ -287,6 +291,8 @@ public function get_item_schema() {
),
);

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

return $this->add_additional_fields_schema( $this->schema );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ public function filter_response_by_context( $data, $context ) {
* @return array Item schema data.
*/
public function get_item_schema() {
if ( $this->schema ) {
return $this->add_additional_fields_schema( $this->schema );
}

// Do not cache this schema because all properties are derived from parent controller.
$schema = parent::get_item_schema();

Expand All @@ -86,7 +90,9 @@ public function get_item_schema() {
unset( $schema['properties']['title']['properties']['rendered'] );
unset( $schema['properties']['content']['properties']['rendered'] );

return $schema;
$this->schema = $schema;

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

}
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,10 @@ protected function get_schema_links() {
* @return array Item schema data.
*/
public function get_item_schema() {
if ( $this->schema ) {
return $this->add_additional_fields_schema( $this->schema );
}

$schema = array(
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => $this->post_type,
Expand Down Expand Up @@ -914,7 +918,9 @@ public function get_item_schema() {
$schema['links'] = $schema_links;
}

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

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

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,10 @@ protected function handle_locations( $menu_id, $request ) {
* @return array Item schema data.
*/
public function get_item_schema() {
if ( $this->schema ) {
return $this->add_additional_fields_schema( $this->schema );
}

$schema = parent::get_item_schema();
unset( $schema['properties']['count'], $schema['properties']['link'], $schema['properties']['taxonomy'] );

Expand Down Expand Up @@ -566,6 +570,8 @@ public function get_item_schema() {
'type' => 'boolean',
);

return $schema;
$this->schema = $schema;

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