From dbdefe273f76051f5faa91bc929b48d20b12b975 Mon Sep 17 00:00:00 2001 From: Simon L Date: Tue, 26 Sep 2023 15:57:22 +0200 Subject: [PATCH] remove justinrainbow/json-schema again Signed-off-by: Simon L Co-Authored-By: szaimen --- php/composer.json | 3 +- php/composer.lock | 84 +++----------------------- php/src/ContainerDefinitionFetcher.php | 18 +----- 3 files changed, 9 insertions(+), 96 deletions(-) diff --git a/php/composer.json b/php/composer.json index 017d2731643..32488056ccf 100644 --- a/php/composer.json +++ b/php/composer.json @@ -16,8 +16,7 @@ "http-interop/http-factory-guzzle": "^1.2", "slim/twig-view": "^3.3", "slim/csrf": "^1.3", - "ext-apcu": "*", - "justinrainbow/json-schema": "^5.2" + "ext-apcu": "*" }, "scripts": { "psalm": "psalm --threads=1", diff --git a/php/composer.lock b/php/composer.lock index 5882ec19c9c..f3eb57b83b7 100644 --- a/php/composer.lock +++ b/php/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3cbf9ef41575f504b9bdbc8dbe8562e3", + "content-hash": "b0074cfbf6b5cde6d6d2207286ad2e85", "packages": [ { "name": "guzzlehttp/guzzle", @@ -389,76 +389,6 @@ }, "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", "version": "v1.3.1", @@ -793,16 +723,16 @@ }, { "name": "psr/http-client", - "version": "1.0.2", + "version": "1.0.3", "source": { "type": "git", "url": "https://github.com/php-fig/http-client.git", - "reference": "0955afe48220520692d2d09f7ab7e0f93ffd6a31" + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-client/zipball/0955afe48220520692d2d09f7ab7e0f93ffd6a31", - "reference": "0955afe48220520692d2d09f7ab7e0f93ffd6a31", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90", "shasum": "" }, "require": { @@ -839,9 +769,9 @@ "psr-18" ], "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", diff --git a/php/src/ContainerDefinitionFetcher.php b/php/src/ContainerDefinitionFetcher.php index 3438b889057..63c46064fb5 100644 --- a/php/src/ContainerDefinitionFetcher.php +++ b/php/src/ContainerDefinitionFetcher.php @@ -12,7 +12,6 @@ use AIO\Data\ConfigurationManager; use AIO\Data\DataConst; use AIO\Docker\DockerActionManager; -use JsonSchema\Validator; class ContainerDefinitionFetcher { @@ -41,27 +40,12 @@ public function GetContainerById(string $id): Container 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 */ private function GetDefinition(bool $latest): array { - $rawData = file_get_contents(__DIR__ . '/../containers.json'); - $objectData = json_decode($rawData, false); - $this->validateJson($objectData); - $data = json_decode($rawData, true); + $data = json_decode(file_get_contents(__DIR__ . '/../containers.json'), true); $containers = []; foreach ($data['aio_services_v1'] as $entry) {