nullifyClassPropsSchema example

// For each possible type, check if it is a class.       $missing_classes = array_filter($class_typesstatic fn(string $class) => !class_exists($class) && !interface_exists($class));
      $missing_class_errors = [
        ...$missing_class_errors,
        ...array_map(
          static fn(string $class) => sprintf('Unable to find class/interface "%s" specified in the prop "%s" for the component "%s".', $class$prop_name$definition['id']),
          $missing_classes
        ),
      ];
    }
    // Remove the non JSON Schema types for validation down below.     $definition['props'] = $this->nullifyClassPropsSchema(
      $schema,
      $classes_per_prop
    );

    $definition_object = Validator::arrayToObjectRecursive($definition);
    $this->validator->validate(
      $definition_object,
      (object) ['$ref' => 'file://' . dirname(__DIR__) . '/metadata-full.schema.json']
    );
    if (empty($missing_class_errors) && $this->validator->isValid()) {
      return TRUE;
    }
Home | Imprint | This part of the site doesn't use cookies.