diff --git a/composer.json b/composer.json index dde6f46..fcc0f7e 100644 --- a/composer.json +++ b/composer.json @@ -7,6 +7,7 @@ "cakephp/collection": "^3.6", "doctrine/annotations": "^1.6", "lcobucci/jwt": "^3.3", + "league/openapi-psr7-validator": "^0.3.2", "nikic/fast-route": "^1.2", "react/http": "^0.8.0", "reactive-apps/command": "dev-master", @@ -38,7 +39,8 @@ "wyrihaximus/to-child-process-or-not-to-child-process": "^1.0", "wyrihaximus/to-coroutine-or-not-to-coroutine": "^1.0", "wyrihaximus/to-thread-or-not-to-thread": "dev-master", - "zendframework/zend-diactoros": "^2.1" + "zendframework/zend-diactoros": "^2.1", + "zircote/swagger-php": "^3.0" }, "require-dev": { "monolog/monolog": "^1.23", diff --git a/composer.lock b/composer.lock index 8991289..3c56a3b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "f1f9f403fa78c3ca1f7a18091c1bd6df", + "content-hash": "2c4eccd9f77799ed472c92c673ae685d", "packages": [ { "name": "api-clients/rx", @@ -252,6 +252,68 @@ ], "time": "2017-12-12T00:49:31+00:00" }, + { + "name": "cebe/php-openapi", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/cebe/php-openapi.git", + "reference": "e316519055c30f603d735bb01b943f7ecb081629" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cebe/php-openapi/zipball/e316519055c30f603d735bb01b943f7ecb081629", + "reference": "e316519055c30f603d735bb01b943f7ecb081629", + "shasum": "" + }, + "require": { + "ext-json": "*", + "justinrainbow/json-schema": "^5.0", + "php": ">=7.1.0", + "symfony/yaml": "^4.0" + }, + "require-dev": { + "apis-guru/openapi-directory": "1.0.0", + "cebe/indent": "*", + "friendsofphp/php-cs-fixer": "~2.13.1", + "mermade/openapi3-examples": "1.0.0", + "nexmo/api-specification": "1.0.0", + "oai/openapi-specification": "3.0.2", + "phpunit/phpunit": "^6.5" + }, + "bin": [ + "bin/php-openapi" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "cebe\\openapi\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Carsten Brandt", + "email": "mail@cebe.cc", + "homepage": "https://cebe.cc/", + "role": "Creator" + } + ], + "description": "READ OpenAPI yaml files and make the content accessable in PHP objects.", + "homepage": "https://github.com/cebe/php-openapi#readme", + "keywords": [ + "openapi" + ], + "time": "2019-06-28T13:51:20+00:00" + }, { "name": "daverandom/exceptional-json", "version": "v1.0.4", @@ -290,6 +352,60 @@ "description": "JSON encoding and decoding that throws exceptions on failure", "time": "2018-06-11T11:25:57+00:00" }, + { + "name": "dflydev/fig-cookies", + "version": "v2.0.0", + "source": { + "type": "git", + "url": "https://github.com/dflydev/dflydev-fig-cookies.git", + "reference": "a59857139b9e30978b5b802b3631b5eaf34e8c66" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dflydev/dflydev-fig-cookies/zipball/a59857139b9e30978b5b802b3631b5eaf34e8c66", + "reference": "a59857139b9e30978b5b802b3631b5eaf34e8c66", + "shasum": "" + }, + "require": { + "ext-pcre": "*", + "php": "^7.2", + "psr/http-message": "^1" + }, + "require-dev": { + "doctrine/coding-standard": "^4", + "phpstan/phpstan": "^0.10.1", + "phpunit/phpunit": "^7.2.6", + "squizlabs/php_codesniffer": "^3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Dflydev\\FigCookies\\": "src/Dflydev/FigCookies" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Beau Simensen", + "email": "beau@dflydev.com" + } + ], + "description": "Cookies for PSR-7 HTTP Message Interface.", + "keywords": [ + "cookies", + "psr-7", + "psr7" + ], + "time": "2018-07-11T06:54:37+00:00" + }, { "name": "doctrine/annotations", "version": "v1.7.0", @@ -1055,6 +1171,72 @@ ], "time": "2015-07-16T22:30:20+00:00" }, + { + "name": "justinrainbow/json-schema", + "version": "5.2.8", + "source": { + "type": "git", + "url": "https://github.com/justinrainbow/json-schema.git", + "reference": "dcb6e1006bb5fd1e392b4daa68932880f37550d4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/dcb6e1006bb5fd1e392b4daa68932880f37550d4", + "reference": "dcb6e1006bb5fd1e392b4daa68932880f37550d4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "~2.2.20", + "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" + ], + "time": "2019-01-14T23:55:14+00:00" + }, { "name": "lcobucci/jwt", "version": "3.3.1", @@ -1194,6 +1376,58 @@ ], "time": "2019-08-24T11:17:19+00:00" }, + { + "name": "league/openapi-psr7-validator", + "version": "0.3.2", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/openapi-psr7-validator.git", + "reference": "7bfd006b9d486578e4307e6f6f690f96a5d39d83" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/openapi-psr7-validator/zipball/7bfd006b9d486578e4307e6f6f690f96a5d39d83", + "reference": "7bfd006b9d486578e4307e6f6f690f96a5d39d83", + "shasum": "" + }, + "require": { + "cebe/php-openapi": "^1.2", + "dflydev/fig-cookies": "^2.0", + "ext-json": "*", + "php": ">=7.2", + "psr/cache": "^1.0", + "psr/http-message": "^1.0", + "psr/http-server-middleware": "^1.0", + "respect/validation": "^1.1", + "riverline/multipart-parser": "^2.0.3", + "webmozart/assert": "^1.4" + }, + "require-dev": { + "cache/array-adapter": "^1.0", + "doctrine/coding-standard": "^6.0", + "guzzlehttp/psr7": "^1.5", + "phpunit/phpunit": "^7|^8" + }, + "type": "library", + "autoload": { + "psr-4": { + "OpenAPIValidation\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Validate PSR-7 messages against OpenAPI (3.0.2) specifications expressed in YAML or JSON", + "homepage": "https://github.com/thephpleague/openapi-psr7-validator", + "keywords": [ + "http", + "openapi", + "psr7", + "validation" + ], + "time": "2019-09-24T12:22:22+00:00" + }, { "name": "micheh/psr7-cache", "version": "0.5", @@ -3474,6 +3708,69 @@ ], "time": "2018-04-05T21:43:59+00:00" }, + { + "name": "respect/validation", + "version": "1.1.31", + "source": { + "type": "git", + "url": "https://github.com/Respect/Validation.git", + "reference": "45d109fc830644fecc1145200d6351ce4f2769d0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Respect/Validation/zipball/45d109fc830644fecc1145200d6351ce4f2769d0", + "reference": "45d109fc830644fecc1145200d6351ce4f2769d0", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "symfony/polyfill-mbstring": "^1.2" + }, + "require-dev": { + "egulias/email-validator": "~1.2 || ~2.1", + "mikey179/vfsstream": "^1.5", + "phpunit/phpunit": "~4.0 || ~5.0", + "symfony/validator": "~2.6.9", + "zendframework/zend-validator": "~2.3" + }, + "suggest": { + "egulias/email-validator": "Strict (RFC compliant) email validation", + "ext-bcmath": "Arbitrary Precision Mathematics", + "ext-mbstring": "Multibyte String Functions", + "friendsofphp/php-cs-fixer": "Fix PSR2 and other coding style issues", + "symfony/validator": "Use Symfony validator through Respect\\Validation", + "zendframework/zend-validator": "Use Zend Framework validator through Respect\\Validation" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "Respect\\Validation\\": "library/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Respect/Validation Contributors", + "homepage": "https://github.com/Respect/Validation/graphs/contributors" + } + ], + "description": "The most awesome validation engine ever created for PHP", + "homepage": "http://respect.github.io/Validation/", + "keywords": [ + "respect", + "validation", + "validator" + ], + "time": "2019-05-28T06:10:06+00:00" + }, { "name": "ringcentral/psr7", "version": "1.2.2", @@ -3532,6 +3829,58 @@ ], "time": "2018-01-15T21:00:49+00:00" }, + { + "name": "riverline/multipart-parser", + "version": "2.0.5", + "source": { + "type": "git", + "url": "https://github.com/Riverline/multipart-parser.git", + "reference": "8bb18f1d374b5d611325c4ac36a5dbdc1cdd9248" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Riverline/multipart-parser/zipball/8bb18f1d374b5d611325c4ac36a5dbdc1cdd9248", + "reference": "8bb18f1d374b5d611325c4ac36a5dbdc1cdd9248", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": ">=5.6.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.2 || ^6.0 || ^7.0", + "psr/http-message": "^1.0", + "symfony/psr-http-message-bridge": "^1.1", + "zendframework/zend-diactoros": "^1.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Riverline\\MultiPartParser\\": "src/Riverline/MultiPartParser/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Romain Cambien", + "email": "romain@cambien.net" + }, + { + "name": "Riverline", + "homepage": "http://www.riverline.fr" + } + ], + "description": "One class library to parse multipart content with encoding and charset support.", + "keywords": [ + "http", + "multipart", + "parser" + ], + "time": "2019-08-26T14:21:49+00:00" + }, { "name": "roave/better-reflection", "version": "3.5.0", @@ -3804,6 +4153,55 @@ ], "time": "2019-06-20T06:46:26+00:00" }, + { + "name": "symfony/finder", + "version": "v4.3.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "86c1c929f0a4b24812e1eb109262fc3372c8e9f2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/86c1c929f0a4b24812e1eb109262fc3372c8e9f2", + "reference": "86c1c929f0a4b24812e1eb109262fc3372c8e9f2", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Finder Component", + "homepage": "https://symfony.com", + "time": "2019-08-14T12:26:46+00:00" + }, { "name": "symfony/http-foundation", "version": "v4.3.4", @@ -4261,42 +4659,107 @@ "time": "2019-08-06T08:03:45+00:00" }, { - "name": "symfony/routing", + "name": "symfony/routing", + "version": "v4.3.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/routing.git", + "reference": "ff1049f6232dc5b6023b1ff1c6de56f82bcd264f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/routing/zipball/ff1049f6232dc5b6023b1ff1c6de56f82bcd264f", + "reference": "ff1049f6232dc5b6023b1ff1c6de56f82bcd264f", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "conflict": { + "symfony/config": "<4.2", + "symfony/dependency-injection": "<3.4", + "symfony/yaml": "<3.4" + }, + "require-dev": { + "doctrine/annotations": "~1.2", + "psr/log": "~1.0", + "symfony/config": "~4.2", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/expression-language": "~3.4|~4.0", + "symfony/http-foundation": "~3.4|~4.0", + "symfony/yaml": "~3.4|~4.0" + }, + "suggest": { + "doctrine/annotations": "For using the annotation loader", + "symfony/config": "For using the all-in-one router or any loader", + "symfony/expression-language": "For using expression matching", + "symfony/http-foundation": "For using a Symfony Request object", + "symfony/yaml": "For using the YAML loader" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Routing\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Routing Component", + "homepage": "https://symfony.com", + "keywords": [ + "router", + "routing", + "uri", + "url" + ], + "time": "2019-08-26T08:26:39+00:00" + }, + { + "name": "symfony/yaml", "version": "v4.3.4", "source": { "type": "git", - "url": "https://github.com/symfony/routing.git", - "reference": "ff1049f6232dc5b6023b1ff1c6de56f82bcd264f" + "url": "https://github.com/symfony/yaml.git", + "reference": "5a0b7c32dc3ec56fd4abae8a4a71b0cf05013686" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/ff1049f6232dc5b6023b1ff1c6de56f82bcd264f", - "reference": "ff1049f6232dc5b6023b1ff1c6de56f82bcd264f", + "url": "https://api.github.com/repos/symfony/yaml/zipball/5a0b7c32dc3ec56fd4abae8a4a71b0cf05013686", + "reference": "5a0b7c32dc3ec56fd4abae8a4a71b0cf05013686", "shasum": "" }, "require": { - "php": "^7.1.3" + "php": "^7.1.3", + "symfony/polyfill-ctype": "~1.8" }, "conflict": { - "symfony/config": "<4.2", - "symfony/dependency-injection": "<3.4", - "symfony/yaml": "<3.4" + "symfony/console": "<3.4" }, "require-dev": { - "doctrine/annotations": "~1.2", - "psr/log": "~1.0", - "symfony/config": "~4.2", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/expression-language": "~3.4|~4.0", - "symfony/http-foundation": "~3.4|~4.0", - "symfony/yaml": "~3.4|~4.0" + "symfony/console": "~3.4|~4.0" }, "suggest": { - "doctrine/annotations": "For using the annotation loader", - "symfony/config": "For using the all-in-one router or any loader", - "symfony/expression-language": "For using expression matching", - "symfony/http-foundation": "For using a Symfony Request object", - "symfony/yaml": "For using the YAML loader" + "symfony/console": "For validating YAML files using the lint command" }, "type": "library", "extra": { @@ -4306,7 +4769,7 @@ }, "autoload": { "psr-4": { - "Symfony\\Component\\Routing\\": "" + "Symfony\\Component\\Yaml\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -4326,15 +4789,9 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Routing Component", + "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "keywords": [ - "router", - "routing", - "uri", - "url" - ], - "time": "2019-08-26T08:26:39+00:00" + "time": "2019-08-20T14:27:59+00:00" }, { "name": "thecodingmachine/safe", @@ -6986,6 +7443,69 @@ "psr-7" ], "time": "2019-07-10T16:13:25+00:00" + }, + { + "name": "zircote/swagger-php", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/zircote/swagger-php.git", + "reference": "f10ab7f81d89dba97653a980cc90cf4b7b73f543" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zircote/swagger-php/zipball/f10ab7f81d89dba97653a980cc90cf4b7b73f543", + "reference": "f10ab7f81d89dba97653a980cc90cf4b7b73f543", + "shasum": "" + }, + "require": { + "doctrine/annotations": "*", + "php": ">=7.0", + "symfony/finder": ">=2.2", + "symfony/yaml": ">=3.3" + }, + "require-dev": { + "phpunit/phpunit": ">=6.3", + "squizlabs/php_codesniffer": ">=3.3", + "zendframework/zend-form": "<2.8" + }, + "bin": [ + "bin/openapi" + ], + "type": "library", + "autoload": { + "psr-4": { + "OpenApi\\": "src" + }, + "files": [ + "src/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Robert Allen", + "email": "zircote@gmail.com", + "homepage": "http://www.zircote.com" + }, + { + "name": "Bob Fanger", + "email": "bfanger@gmail.com", + "homepage": "http://bfanger.nl" + } + ], + "description": "swagger-php - Generate interactive documentation for your RESTful API using phpdoc annotations", + "homepage": "https://github.com/zircote/swagger-php/", + "keywords": [ + "api", + "json", + "rest", + "service discovery" + ], + "time": "2018-11-16T15:04:29+00:00" } ], "packages-dev": [ @@ -8146,72 +8666,6 @@ ], "time": "2018-06-13T13:22:40+00:00" }, - { - "name": "justinrainbow/json-schema", - "version": "5.2.8", - "source": { - "type": "git", - "url": "https://github.com/justinrainbow/json-schema.git", - "reference": "dcb6e1006bb5fd1e392b4daa68932880f37550d4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/dcb6e1006bb5fd1e392b4daa68932880f37550d4", - "reference": "dcb6e1006bb5fd1e392b4daa68932880f37550d4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "~2.2.20", - "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" - ], - "time": "2019-01-14T23:55:14+00:00" - }, { "name": "localheinz/composer-json-normalizer", "version": "1.0.2", @@ -11270,55 +11724,6 @@ "homepage": "https://symfony.com", "time": "2019-08-20T14:07:54+00:00" }, - { - "name": "symfony/finder", - "version": "v4.3.4", - "source": { - "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "86c1c929f0a4b24812e1eb109262fc3372c8e9f2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/86c1c929f0a4b24812e1eb109262fc3372c8e9f2", - "reference": "86c1c929f0a4b24812e1eb109262fc3372c8e9f2", - "shasum": "" - }, - "require": { - "php": "^7.1.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Finder\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Finder Component", - "homepage": "https://symfony.com", - "time": "2019-08-14T12:26:46+00:00" - }, { "name": "symfony/options-resolver", "version": "v4.3.4", @@ -11647,65 +12052,6 @@ "homepage": "https://symfony.com", "time": "2019-08-07T11:52:19+00:00" }, - { - "name": "symfony/yaml", - "version": "v4.3.4", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "5a0b7c32dc3ec56fd4abae8a4a71b0cf05013686" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/5a0b7c32dc3ec56fd4abae8a4a71b0cf05013686", - "reference": "5a0b7c32dc3ec56fd4abae8a4a71b0cf05013686", - "shasum": "" - }, - "require": { - "php": "^7.1.3", - "symfony/polyfill-ctype": "~1.8" - }, - "conflict": { - "symfony/console": "<3.4" - }, - "require-dev": { - "symfony/console": "~3.4|~4.0" - }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", - "time": "2019-08-20T14:27:59+00:00" - }, { "name": "thecodingmachine/phpstan-safe-rule", "version": "v0.1.4", diff --git a/etc/di/open-api.php b/etc/di/open-api.php new file mode 100644 index 0000000..20f6c49 --- /dev/null +++ b/etc/di/open-api.php @@ -0,0 +1,34 @@ + \DI\factory(function ( + OpenApi $openApi + ) { + return $openApi->toYaml(); + }) + ->parameter('openApi', \DI\get('internal.http-server.open-api.openapi')), + 'internal.http-server.open-api.json' => \DI\factory(function ( + OpenApi $openApi + ) { + return $openApi->toJson(); + }) + ->parameter('openApi', \DI\get('internal.http-server.open-api.openapi')), + 'internal.http-server.open-api.openapi' => \DI\factory(function ( + string $root + ) { + return scan( + $root, + [ + 'exclude' => [ + $root . 'vendor', + $root . 'tests', + $root . 'etc', + ] + ], + ); + }) + ->parameter('root', \DI\get('config.root')), +]; diff --git a/src/Controller/OpenAPI.php b/src/Controller/OpenAPI.php new file mode 100644 index 0000000..f25db55 --- /dev/null +++ b/src/Controller/OpenAPI.php @@ -0,0 +1,52 @@ +yaml = $yaml; + } + + /** + * @Method("GET") + * @Routes({ + * "/openapi.yml" + * }) + * + * @param ServerRequestInterface $request + * @return ResponseInterface + */ + public function spec(ServerRequestInterface $request): ResponseInterface + { + return new Response( + 200, + [ + 'Content-Type' => 'application/x-yaml', + ], + $this->yaml, + ); + } +}