diff --git a/.github/workflows/cgl.yaml b/.github/workflows/cgl.yaml index 0fa1068..176d3ed 100644 --- a/.github/workflows/cgl.yaml +++ b/.github/workflows/cgl.yaml @@ -46,6 +46,8 @@ jobs: run: composer lint:composer - name: Lint Editorconfig run: composer lint:editorconfig + - name: Lint JSON + run: composer lint:json - name: Lint PHP run: composer lint:php -- --format=checkstyle | cs2pr @@ -56,3 +58,7 @@ jobs: # Migration - name: Rector migration run: composer migration:rector -- --dry-run + + # Schema + - name: Validate configuration schema + run: composer validate-schema diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 259a2a4..ea9d5c0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,6 +29,7 @@ composer lint # Specific linters composer lint:composer composer lint:editorconfig +composer lint:json composer lint:php # Fix all CGL issues @@ -37,6 +38,7 @@ composer fix # Fix specific CGL issues composer fix:composer composer fix:editorconfig +composer fix:json composer fix:php ``` @@ -50,6 +52,14 @@ composer sca composer sca:php ``` +## Validate configuration schema + +```bash +composer validate-schema +``` + +💡 You need a local Docker installation for this command. + ## Run tests ```bash diff --git a/composer.json b/composer.json index d178a41..429d753 100644 --- a/composer.json +++ b/composer.json @@ -50,7 +50,8 @@ "phpstan/phpstan-symfony": "^1.1", "phpstan/phpstan-webmozart-assert": "^1.2", "phpunit/phpunit": "^10.1 || ^11.0", - "rector/rector": "^1.0.0" + "rector/rector": "^1.0.0", + "seld/jsonlint": "^1.10" }, "suggest": { "gmostafa/php-graphql-client": "Used to perform GraphQL requests within GithubVcsProvider (^1.13)" @@ -79,18 +80,22 @@ "fix": [ "@fix:composer", "@fix:editorconfig", + "@fix:json", "@fix:php" ], "fix:composer": "@composer normalize", "fix:editorconfig": "@lint:editorconfig --fix", + "fix:json": "@lint:json", "fix:php": "php-cs-fixer fix", "lint": [ "@lint:composer", "@lint:editorconfig", + "@lint:json", "@lint:php" ], "lint:composer": "@fix:composer --dry-run", "lint:editorconfig": "ec", + "lint:json": "jsonlint resources/configuration.schema.json", "lint:php": "@fix:php --dry-run", "migration": [ "@migration:rector" @@ -104,6 +109,7 @@ "phpstan analyse -c phpstan.neon" ], "test": "@test:coverage --no-coverage", - "test:coverage": "phpunit -c phpunit.xml" + "test:coverage": "phpunit -c phpunit.xml", + "validate-schema": "docker run --rm -v \"$(pwd)\":/code swaggest/json-cli json-cli validate-schema resources/configuration.schema.json" } } diff --git a/composer.lock b/composer.lock index 4c278c8..5e397ef 100644 --- a/composer.lock +++ b/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": "621ae78d5928fde03c79cc1a7905d085", + "content-hash": "d2465dee0563f645975da7345a95467b", "packages": [ { "name": "ergebnis/json", @@ -5038,6 +5038,70 @@ ], "time": "2023-02-07T11:34:05+00:00" }, + { + "name": "seld/jsonlint", + "version": "1.10.2", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/jsonlint.git", + "reference": "9bb7db07b5d66d90f6ebf542f09fc67d800e5259" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/9bb7db07b5d66d90f6ebf542f09fc67d800e5259", + "reference": "9bb7db07b5d66d90f6ebf542f09fc67d800e5259", + "shasum": "" + }, + "require": { + "php": "^5.3 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.5", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0 || ^8.5.13" + }, + "bin": [ + "bin/jsonlint" + ], + "type": "library", + "autoload": { + "psr-4": { + "Seld\\JsonLint\\": "src/Seld/JsonLint/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "https://seld.be" + } + ], + "description": "JSON Linter", + "keywords": [ + "json", + "linter", + "parser", + "validator" + ], + "support": { + "issues": "https://github.com/Seldaek/jsonlint/issues", + "source": "https://github.com/Seldaek/jsonlint/tree/1.10.2" + }, + "funding": [ + { + "url": "https://github.com/Seldaek", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/seld/jsonlint", + "type": "tidelift" + } + ], + "time": "2024-02-07T12:57:50+00:00" + }, { "name": "symfony/event-dispatcher", "version": "v6.4.3",