Script
I made a small PHP script to detect the lowest schema version required for each test file. It can be translated to an other language and run in CI.
```php
= 0; $i--) {
$newVersion = "1." . $i;
if (validateJsonFile($jsonFile, $newVersion)) {
$currentVersion = $newVersion;
} else {
break;
}
}
return $currentVersion;
}
$jsonFiles = [];
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator('source/'));
foreach ($iterator as $file) {
if ($file->isFile() && $file->getExtension() === 'json' && !str_contains($file->getPathname(), 'source/unified-test-format')) {
$jsonFiles[] = $file->getPathname();
}
}
foreach ($jsonFiles as $jsonFile) {
$lowestVersion = getLowestSchemaVersion($jsonFile);
if ($lowestVersion) {
modifySchemaVersion($jsonFile, $lowestVersion);
}
}
```
Fix DRIVERS-2644 This change is necessary for https://github.com/mongodb/mongo-php-library/pull/1090#discussion_r1212163608
Script
I made a small PHP script to detect the lowest schema version required for each test file. It can be translated to an other language and run in CI. ```php = 0; $i--) { $newVersion = "1." . $i; if (validateJsonFile($jsonFile, $newVersion)) { $currentVersion = $newVersion; } else { break; } } return $currentVersion; } $jsonFiles = []; $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator('source/')); foreach ($iterator as $file) { if ($file->isFile() && $file->getExtension() === 'json' && !str_contains($file->getPathname(), 'source/unified-test-format')) { $jsonFiles[] = $file->getPathname(); } } foreach ($jsonFiles as $jsonFile) { $lowestVersion = getLowestSchemaVersion($jsonFile); if ($lowestVersion) { modifySchemaVersion($jsonFile, $lowestVersion); } } ```