p59b
This commit is contained in:
@@ -1121,6 +1121,26 @@ final readonly class RetriexEffectiveConfigProvider
|
||||
$errors[] = 'genre.mode must not be empty.';
|
||||
}
|
||||
|
||||
$configurationValues = $genre['configuration_values'] ?? null;
|
||||
if (!is_array($configurationValues) || $configurationValues === []) {
|
||||
$errors[] = 'genre.configuration_values must be a non-empty map.';
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($configurationValues as $group => $valueDefinition) {
|
||||
if (!is_string($group) || trim($group) === '') {
|
||||
$errors[] = 'genre.configuration_values keys must be non-empty strings.';
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!is_array($valueDefinition) || $valueDefinition === []) {
|
||||
$errors[] = sprintf('genre.configuration_values.%s must be a non-empty map.', $group);
|
||||
}
|
||||
}
|
||||
|
||||
$configurationValuePaths = [];
|
||||
$this->flattenEffectiveConfigPath('configuration_values', $configurationValues, $configurationValuePaths);
|
||||
|
||||
$surface = $genre['adaptation_surface'] ?? null;
|
||||
if (!is_array($surface) || $surface === []) {
|
||||
$errors[] = 'genre.adaptation_surface must be a non-empty map.';
|
||||
@@ -1148,41 +1168,78 @@ final readonly class RetriexEffectiveConfigProvider
|
||||
continue;
|
||||
}
|
||||
|
||||
$paths = $definition['paths'] ?? null;
|
||||
if (!is_array($paths) || $paths === []) {
|
||||
$errors[] = sprintf('genre.adaptation_surface.%s.paths must be a non-empty list.', $group);
|
||||
if (!array_key_exists($group, $configurationValues)) {
|
||||
$warnings[] = sprintf('genre.configuration_values is missing value group for adaptation_surface.%s.', $group);
|
||||
}
|
||||
|
||||
$valuePaths = $definition['value_paths'] ?? null;
|
||||
$legacyPaths = $definition['paths'] ?? null;
|
||||
if ((!is_array($valuePaths) || $valuePaths === []) && (!is_array($legacyPaths) || $legacyPaths === [])) {
|
||||
$errors[] = sprintf('genre.adaptation_surface.%s.value_paths must be a non-empty list.', $group);
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($paths as $path) {
|
||||
if (!is_string($path) || trim($path) === '') {
|
||||
$errors[] = sprintf('genre.adaptation_surface.%s.paths must contain non-empty strings.', $group);
|
||||
if (is_array($valuePaths)) {
|
||||
if ($valuePaths === []) {
|
||||
$errors[] = sprintf('genre.adaptation_surface.%s.value_paths must be a non-empty list when declared.', $group);
|
||||
}
|
||||
|
||||
foreach ($valuePaths as $path) {
|
||||
if (!is_string($path) || trim($path) === '') {
|
||||
$errors[] = sprintf('genre.adaptation_surface.%s.value_paths must contain non-empty strings.', $group);
|
||||
continue;
|
||||
}
|
||||
|
||||
$path = trim($path);
|
||||
if (!str_starts_with($path, 'configuration_values.' . $group . '.')) {
|
||||
$warnings[] = sprintf('genre.adaptation_surface.%s.value_paths should reference configuration_values.%s.*: %s.', $group, $group, $path);
|
||||
}
|
||||
|
||||
if (!isset($configurationValuePaths[$path])) {
|
||||
$warnings[] = sprintf('genre.adaptation_surface.%s references unknown genre value path: %s.', $group, $path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($legacyPaths)) {
|
||||
if ($legacyPaths === []) {
|
||||
$errors[] = sprintf('genre.adaptation_surface.%s.paths must be a non-empty list when declared.', $group);
|
||||
}
|
||||
|
||||
foreach ($legacyPaths as $path) {
|
||||
if (!is_string($path) || trim($path) === '') {
|
||||
$errors[] = sprintf('genre.adaptation_surface.%s.paths must contain non-empty strings.', $group);
|
||||
continue;
|
||||
}
|
||||
|
||||
$path = trim($path);
|
||||
if (!isset($flattened[$path])) {
|
||||
$warnings[] = sprintf('genre.adaptation_surface.%s references unknown config path: %s.', $group, $path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$reviewPaths = $definition['review_paths'] ?? null;
|
||||
if (array_key_exists('review_paths', $definition)) {
|
||||
if (!is_array($reviewPaths) || $reviewPaths === []) {
|
||||
$errors[] = sprintf('genre.adaptation_surface.%s.review_paths must be a non-empty list when declared.', $group);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($flattened[$path])) {
|
||||
$warnings[] = sprintf('genre.adaptation_surface.%s references unknown config path: %s.', $group, $path);
|
||||
foreach ($reviewPaths as $path) {
|
||||
if (!is_string($path) || trim($path) === '') {
|
||||
$errors[] = sprintf('genre.adaptation_surface.%s.review_paths must contain non-empty strings.', $group);
|
||||
continue;
|
||||
}
|
||||
|
||||
$path = trim($path);
|
||||
if (!isset($flattened[$path])) {
|
||||
$warnings[] = sprintf('genre.adaptation_surface.%s references unknown review path: %s.', $group, $path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$configurationValues = $genre['configuration_values'] ?? null;
|
||||
if (!is_array($configurationValues) || $configurationValues === []) {
|
||||
$errors[] = 'genre.configuration_values must be a non-empty map.';
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($configurationValues as $group => $valueDefinition) {
|
||||
if (!is_string($group) || trim($group) === '') {
|
||||
$errors[] = 'genre.configuration_values keys must be non-empty strings.';
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!is_array($valueDefinition) || $valueDefinition === []) {
|
||||
$errors[] = sprintf('genre.configuration_values.%s must be a non-empty map.', $group);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->collectGenreConfigurationValueSourcePaths($configurationValues) as $valuePath => $sourcePaths) {
|
||||
foreach ($sourcePaths as $sourcePath) {
|
||||
if (!isset($flattened[$sourcePath])) {
|
||||
|
||||
Reference in New Issue
Block a user