Page MenuHomePhabricator

Refactor ArrayDef::validate and ConfigSchemaAggregator::validateValue
Open, In Progress, MediumPublic

Description

From T362108: Implement JSON schema validation in ArrayDef ArrayDef::validate now implements JSON schema validation

We should investigate how much of that code we may be able to move into JsonSchemaTrait so it can be shared between ArrayDef and ConfigSchemaAggregator.

Event Timeline

daniel triaged this task as Medium priority.Jun 12 2024, 3:43 PM
Atieno changed the task status from Open to In Progress.Jul 18 2024, 3:05 PM

Similarities

  • Same logic for validating schema type
  • Both validate both Objects and Arrays
  • Both validate in the same way except ArrayDef::validate has an extra CHECK_MODE Constraint
ArrayDef::validateConfiSchemaAggregator::validateValue
schema['type'] not set throws InvalidArgumentException]schema['type'] not set defaults to empty array
gets schema passed through the $settings arraygets the schema from the key that's passed through the $key param
valid validation returns the value itselfvalid value returns StatusValue instance
creates a new Validator instance for each new callreuses preset Validator instance
  NODES
Note 1
Project 2