WordPress at a glance
function is not described

rest_default_additional_properties_to_false() WP 5.5.0

Sets the "additionalProperties" to false by default for all object definitions in the schema.

No Hooks.

Return

Array. The modified schema.

Usage

rest_default_additional_properties_to_false( $schema );
$schema(array) (required)
The schema to modify.

Changelog

Since 5.5.0 Introduced.
Since 5.6.0 Support the "patternProperties" keyword.

Code of rest_default_additional_properties_to_false() WP 5.7.2

<?php
function rest_default_additional_properties_to_false( $schema ) {
	$type = (array) $schema['type'];

	if ( in_array( 'object', $type, true ) ) {
		if ( isset( $schema['properties'] ) ) {
			foreach ( $schema['properties'] as $key => $child_schema ) {
				$schema['properties'][ $key ] = rest_default_additional_properties_to_false( $child_schema );
			}
		}

		if ( isset( $schema['patternProperties'] ) ) {
			foreach ( $schema['patternProperties'] as $key => $child_schema ) {
				$schema['patternProperties'][ $key ] = rest_default_additional_properties_to_false( $child_schema );
			}
		}

		if ( ! isset( $schema['additionalProperties'] ) ) {
			$schema['additionalProperties'] = false;
		}
	}

	if ( in_array( 'array', $type, true ) ) {
		if ( isset( $schema['items'] ) ) {
			$schema['items'] = rest_default_additional_properties_to_false( $schema['items'] );
		}
	}

	return $schema;
}