Make WordPress Core

Opened 3 years ago

#53828 new defect (bug)

Nullable registered meta with format does not display in JSON schema

Reported by: chrisvanpatten's profile chrisvanpatten Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: REST API Keywords:
Focuses: rest-api Cc:


When registering a piece of meta as a nullable type in the REST schema, it does not display in the JSON schema for the particular object.

For example, the following will not correctly register a meta key in REST:

                'single'       => true,
                'type'         => 'string',
                'show_in_rest' => [
                        'schema' => [
                                'title'  => __( 'Background Color' ),
                                'type'   => [ 'string', 'null' ],
                                'format' => 'hex-color',

The key will not be visible in the JSON schema, and the key/value pair will also not be available in the meta object in the post response from the API.

Change History (0)

Note: See TracTickets for help on using tickets.