Page MenuHomePhabricator

Memorize processed references
Open, LowPublic

Description

In T357718 we introduced support for json schema references by enhancing JsonSchemaTrait::normalizeJsonSchema in core (1015288). There's an opportunity to speed up the processing of some schemas by memorizing already resolved and normalized references. This would impact in a schema which references several times the same definition.

Example schema

class Example extends JsonSchema {
	public const ExampleSchemaProp = [
		self::TYPE => self::TYPE_OBJECT,
		self::PROPERTIES => [
			'foo' => [
				self::REF => [ 'class' => Some::class, 'field' => 'SomeField' ],
			],
			'bar' => [
				self::REF => [ 'class' => Some::class, 'field' => 'SomeField' ],
			],
		],
		self::ADDITIONAL_PROPERTIES => false,
	];
}

Acceptance criteria

  • Each distinct referenced definition in a json schema is only processed one time

Related Objects