remove justinrainbow/json-schema again

Signed-off-by: Simon L <szaimen@e.mail.de>
Co-Authored-By: szaimen <szaimen@users.noreply.github.com>
This commit is contained in:
Simon L 2023-09-26 15:57:22 +02:00
parent 3e08843b14
commit dbdefe273f
3 changed files with 9 additions and 96 deletions

View file

@ -16,8 +16,7 @@
"http-interop/http-factory-guzzle": "^1.2", "http-interop/http-factory-guzzle": "^1.2",
"slim/twig-view": "^3.3", "slim/twig-view": "^3.3",
"slim/csrf": "^1.3", "slim/csrf": "^1.3",
"ext-apcu": "*", "ext-apcu": "*"
"justinrainbow/json-schema": "^5.2"
}, },
"scripts": { "scripts": {
"psalm": "psalm --threads=1", "psalm": "psalm --threads=1",

84
php/composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "3cbf9ef41575f504b9bdbc8dbe8562e3", "content-hash": "b0074cfbf6b5cde6d6d2207286ad2e85",
"packages": [ "packages": [
{ {
"name": "guzzlehttp/guzzle", "name": "guzzlehttp/guzzle",
@ -389,76 +389,6 @@
}, },
"time": "2021-07-21T13:50:14+00:00" "time": "2021-07-21T13:50:14+00:00"
}, },
{
"name": "justinrainbow/json-schema",
"version": "5.2.12",
"source": {
"type": "git",
"url": "https://github.com/justinrainbow/json-schema.git",
"reference": "ad87d5a5ca981228e0e205c2bc7dfb8e24559b60"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/ad87d5a5ca981228e0e205c2bc7dfb8e24559b60",
"reference": "ad87d5a5ca981228e0e205c2bc7dfb8e24559b60",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "~2.2.20||~2.15.1",
"json-schema/json-schema-test-suite": "1.2.0",
"phpunit/phpunit": "^4.8.35"
},
"bin": [
"bin/validate-json"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.0.x-dev"
}
},
"autoload": {
"psr-4": {
"JsonSchema\\": "src/JsonSchema/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Bruno Prieto Reis",
"email": "bruno.p.reis@gmail.com"
},
{
"name": "Justin Rainbow",
"email": "justin.rainbow@gmail.com"
},
{
"name": "Igor Wiedler",
"email": "igor@wiedler.ch"
},
{
"name": "Robert Schönthal",
"email": "seroscho@googlemail.com"
}
],
"description": "A library to validate a json schema.",
"homepage": "https://github.com/justinrainbow/json-schema",
"keywords": [
"json",
"schema"
],
"support": {
"issues": "https://github.com/justinrainbow/json-schema/issues",
"source": "https://github.com/justinrainbow/json-schema/tree/5.2.12"
},
"time": "2022-04-13T08:02:27+00:00"
},
{ {
"name": "laravel/serializable-closure", "name": "laravel/serializable-closure",
"version": "v1.3.1", "version": "v1.3.1",
@ -793,16 +723,16 @@
}, },
{ {
"name": "psr/http-client", "name": "psr/http-client",
"version": "1.0.2", "version": "1.0.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/php-fig/http-client.git", "url": "https://github.com/php-fig/http-client.git",
"reference": "0955afe48220520692d2d09f7ab7e0f93ffd6a31" "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/php-fig/http-client/zipball/0955afe48220520692d2d09f7ab7e0f93ffd6a31", "url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90",
"reference": "0955afe48220520692d2d09f7ab7e0f93ffd6a31", "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -839,9 +769,9 @@
"psr-18" "psr-18"
], ],
"support": { "support": {
"source": "https://github.com/php-fig/http-client/tree/1.0.2" "source": "https://github.com/php-fig/http-client"
}, },
"time": "2023-04-10T20:12:12+00:00" "time": "2023-09-23T14:17:50+00:00"
}, },
{ {
"name": "psr/http-factory", "name": "psr/http-factory",

View file

@ -12,7 +12,6 @@ use AIO\Container\State\RunningState;
use AIO\Data\ConfigurationManager; use AIO\Data\ConfigurationManager;
use AIO\Data\DataConst; use AIO\Data\DataConst;
use AIO\Docker\DockerActionManager; use AIO\Docker\DockerActionManager;
use JsonSchema\Validator;
class ContainerDefinitionFetcher class ContainerDefinitionFetcher
{ {
@ -41,27 +40,12 @@ class ContainerDefinitionFetcher
throw new \Exception("The provided id " . $id . " was not found in the container definition."); throw new \Exception("The provided id " . $id . " was not found in the container definition.");
} }
private function validateJson(object $data): void {
// Validate against json schema
$validator = new Validator;
$validator->validate($data, (object)[file_get_contents(__DIR__ . '/../containers-schema.json')]);
if (!$validator->isValid()) {
error_log("JSON does not validate. Violations:");
foreach ($validator->getErrors() as $error) {
error_log((string)printf("[%s] %s\n", $error['property'], $error['message']));
}
}
}
/** /**
* @return array * @return array
*/ */
private function GetDefinition(bool $latest): array private function GetDefinition(bool $latest): array
{ {
$rawData = file_get_contents(__DIR__ . '/../containers.json'); $data = json_decode(file_get_contents(__DIR__ . '/../containers.json'), true);
$objectData = json_decode($rawData, false);
$this->validateJson($objectData);
$data = json_decode($rawData, true);
$containers = []; $containers = [];
foreach ($data['aio_services_v1'] as $entry) { foreach ($data['aio_services_v1'] as $entry) {