From abc5ec134ee368da81fe8527eb4335ab7a377d91 Mon Sep 17 00:00:00 2001 From: Cees-Jan Kiewiet Date: Thu, 5 Dec 2024 07:59:27 +0100 Subject: [PATCH] Fix leading slash --- composer.json | 1 + composer.lock | 295 +++++++++++++++++++++--------------- src/Hydrator.php | 2 +- tests/DataTests/Aliases.php | 20 +++ tests/DataTests/Basic.php | 3 +- tests/HydratorTest.php | 20 ++- 6 files changed, 217 insertions(+), 124 deletions(-) diff --git a/composer.json b/composer.json index 8f79c01..4609125 100644 --- a/composer.json +++ b/composer.json @@ -18,6 +18,7 @@ }, "require-dev": { "openapi-tools/gatherer": "dev-main", + "openapi-tools/generator-schema": "dev-main", "openapi-tools/test-data": "dev-main", "wyrihaximus/test-utilities": "^6.0.10" }, diff --git a/composer.lock b/composer.lock index 2b6f0c8..395b342 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": "d20b693bb13918bee9083c2906787f21", + "content-hash": "601e4dbb2f39ddab1823390e902a7adb", "packages": [ { "name": "devizzent/cebe-php-openapi", @@ -445,12 +445,12 @@ "source": { "type": "git", "url": "https://github.com/php-openapi-tools/utils.git", - "reference": "e83f5d031f62a47419ea2da5751aee59d59a7b14" + "reference": "f6fb6cfb736591b5783cd182d3994ae9270c906a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-openapi-tools/utils/zipball/e83f5d031f62a47419ea2da5751aee59d59a7b14", - "reference": "e83f5d031f62a47419ea2da5751aee59d59a7b14", + "url": "https://api.github.com/repos/php-openapi-tools/utils/zipball/f6fb6cfb736591b5783cd182d3994ae9270c906a", + "reference": "f6fb6cfb736591b5783cd182d3994ae9270c906a", "shasum": "" }, "require": { @@ -489,7 +489,7 @@ "type": "github" } ], - "time": "2024-11-06T11:34:41+00:00" + "time": "2024-11-14T15:30:41+00:00" }, { "name": "symfony/polyfill-ctype", @@ -1682,16 +1682,16 @@ }, { "name": "composer/pcre", - "version": "3.3.1", + "version": "3.3.2", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "63aaeac21d7e775ff9bc9d45021e1745c97521c4" + "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/63aaeac21d7e775ff9bc9d45021e1745c97521c4", - "reference": "63aaeac21d7e775ff9bc9d45021e1745c97521c4", + "url": "https://api.github.com/repos/composer/pcre/zipball/b2bed4734f0cc156ee1fe9c0da2550420d99a21e", + "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e", "shasum": "" }, "require": { @@ -1701,8 +1701,8 @@ "phpstan/phpstan": "<1.11.10" }, "require-dev": { - "phpstan/phpstan": "^1.11.10", - "phpstan/phpstan-strict-rules": "^1.1", + "phpstan/phpstan": "^1.12 || ^2", + "phpstan/phpstan-strict-rules": "^1 || ^2", "phpunit/phpunit": "^8 || ^9" }, "type": "library", @@ -1741,7 +1741,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/3.3.1" + "source": "https://github.com/composer/pcre/tree/3.3.2" }, "funding": [ { @@ -1757,7 +1757,7 @@ "type": "tidelift" } ], - "time": "2024-08-27T18:44:43+00:00" + "time": "2024-11-12T16:29:46+00:00" }, { "name": "composer/semver", @@ -4133,16 +4133,16 @@ }, { "name": "maglnet/composer-require-checker", - "version": "4.13.0", + "version": "4.14.0", "source": { "type": "git", "url": "https://github.com/maglnet/ComposerRequireChecker.git", - "reference": "3f998740566e3e9b3f7321167fd2f4fd645129da" + "reference": "b6d5acd89d0de1727c1188157fa99552c39d1dfb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/maglnet/ComposerRequireChecker/zipball/3f998740566e3e9b3f7321167fd2f4fd645129da", - "reference": "3f998740566e3e9b3f7321167fd2f4fd645129da", + "url": "https://api.github.com/repos/maglnet/ComposerRequireChecker/zipball/b6d5acd89d0de1727c1188157fa99552c39d1dfb", + "reference": "b6d5acd89d0de1727c1188157fa99552c39d1dfb", "shasum": "" }, "require": { @@ -4158,8 +4158,8 @@ "doctrine/coding-standard": "^12.0.0", "ext-zend-opcache": "*", "phing/phing": "^2.17.4", - "phpstan/phpstan": "^1.12.6", - "phpunit/phpunit": "^10.5.36", + "phpstan/phpstan": "^1.12.10", + "phpunit/phpunit": "^10.5.38", "psalm/plugin-phpunit": "^0.19.0", "roave/infection-static-analysis-plugin": "^1.35.0", "spatie/temporary-directory": "^2.2.1", @@ -4208,9 +4208,9 @@ ], "support": { "issues": "https://github.com/maglnet/ComposerRequireChecker/issues", - "source": "https://github.com/maglnet/ComposerRequireChecker/tree/4.13.0" + "source": "https://github.com/maglnet/ComposerRequireChecker/tree/4.14.0" }, - "time": "2024-10-18T08:08:55+00:00" + "time": "2024-11-13T02:00:19+00:00" }, { "name": "marc-mabe/php-enum", @@ -4370,16 +4370,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.12.0", + "version": "1.12.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c" + "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", - "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/123267b2c49fbf30d78a7b2d333f6be754b94845", + "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845", "shasum": "" }, "require": { @@ -4418,7 +4418,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.12.0" + "source": "https://github.com/myclabs/DeepCopy/tree/1.12.1" }, "funding": [ { @@ -4426,7 +4426,7 @@ "type": "tidelift" } ], - "time": "2024-06-12T14:39:25+00:00" + "time": "2024-11-08T17:47:46+00:00" }, { "name": "netresearch/jsonmapper", @@ -5472,6 +5472,64 @@ ], "time": "2024-06-29T19:54:27+00:00" }, + { + "name": "openapi-tools/generator-schema", + "version": "dev-main", + "source": { + "type": "git", + "url": "https://github.com/php-openapi-tools/generator-schema.git", + "reference": "b1a525e0677e4356baae186902549ba923b95b4b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-openapi-tools/generator-schema/zipball/b1a525e0677e4356baae186902549ba923b95b4b", + "reference": "b1a525e0677e4356baae186902549ba923b95b4b", + "shasum": "" + }, + "require": { + "eventsauce/object-hydrator": "^1.5", + "ext-json": "^8.2", + "nikic/php-parser": "^4.19", + "openapi-tools/contract": "dev-main", + "openapi-tools/representation": "dev-main", + "openapi-tools/utils": "dev-main", + "php": "^8.2" + }, + "require-dev": { + "openapi-tools/gatherer": "dev-main", + "openapi-tools/test-data": "dev-main", + "wyrihaximus/test-utilities": "^6.0.10" + }, + "default-branch": true, + "type": "library", + "autoload": { + "psr-4": { + "OpenAPITools\\Generator\\Schema\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Cees-Jan Kiewiet", + "email": "ceesjank@gmail.com" + } + ], + "description": "Schema (+ contract + error) generator", + "support": { + "issues": "https://github.com/php-openapi-tools/generator-schema/issues", + "source": "https://github.com/php-openapi-tools/generator-schema/tree/main" + }, + "funding": [ + { + "url": "https://github.com/WyriHaximus", + "type": "github" + } + ], + "time": "2024-11-07T14:49:47+00:00" + }, { "name": "openapi-tools/registry", "version": "dev-main", @@ -6101,16 +6159,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.5.0", + "version": "5.6.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "54e10d44fc1a84e2598d26f70d4f6f1f233e228a" + "reference": "f3558a4c23426d12bffeaab463f8a8d8b681193c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/54e10d44fc1a84e2598d26f70d4f6f1f233e228a", - "reference": "54e10d44fc1a84e2598d26f70d4f6f1f233e228a", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/f3558a4c23426d12bffeaab463f8a8d8b681193c", + "reference": "f3558a4c23426d12bffeaab463f8a8d8b681193c", "shasum": "" }, "require": { @@ -6119,7 +6177,7 @@ "php": "^7.4 || ^8.0", "phpdocumentor/reflection-common": "^2.2", "phpdocumentor/type-resolver": "^1.7", - "phpstan/phpdoc-parser": "^1.7", + "phpstan/phpdoc-parser": "^1.7|^2.0", "webmozart/assert": "^1.9.1" }, "require-dev": { @@ -6159,29 +6217,29 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.5.0" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.6.0" }, - "time": "2024-11-04T21:26:31+00:00" + "time": "2024-11-12T11:25:25+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "1.9.0", + "version": "1.10.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "1fb5ba8d045f5dd984ebded5b1cc66f29459422d" + "reference": "679e3ce485b99e84c775d28e2e96fade9a7fb50a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/1fb5ba8d045f5dd984ebded5b1cc66f29459422d", - "reference": "1fb5ba8d045f5dd984ebded5b1cc66f29459422d", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/679e3ce485b99e84c775d28e2e96fade9a7fb50a", + "reference": "679e3ce485b99e84c775d28e2e96fade9a7fb50a", "shasum": "" }, "require": { "doctrine/deprecations": "^1.0", "php": "^7.3 || ^8.0", "phpdocumentor/reflection-common": "^2.0", - "phpstan/phpdoc-parser": "^1.18" + "phpstan/phpdoc-parser": "^1.18|^2.0" }, "require-dev": { "ext-tokenizer": "*", @@ -6217,9 +6275,9 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.9.0" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.10.0" }, - "time": "2024-11-03T20:11:34+00:00" + "time": "2024-11-09T15:12:26+00:00" }, { "name": "phpstan/phpdoc-parser", @@ -6270,16 +6328,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.7", + "version": "1.12.10", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "dc2b9976bd8b0f84ec9b0e50cc35378551de7af0" + "reference": "fc463b5d0fe906dcf19689be692c65c50406a071" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/dc2b9976bd8b0f84ec9b0e50cc35378551de7af0", - "reference": "dc2b9976bd8b0f84ec9b0e50cc35378551de7af0", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/fc463b5d0fe906dcf19689be692c65c50406a071", + "reference": "fc463b5d0fe906dcf19689be692c65c50406a071", "shasum": "" }, "require": { @@ -6324,7 +6382,7 @@ "type": "github" } ], - "time": "2024-10-18T11:12:07+00:00" + "time": "2024-11-11T15:37:09+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", @@ -6425,21 +6483,21 @@ }, { "name": "phpstan/phpstan-phpunit", - "version": "1.4.0", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-phpunit.git", - "reference": "f3ea021866f4263f07ca3636bf22c64be9610c11" + "reference": "11d4235fbc6313ecbf93708606edfd3222e44949" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/f3ea021866f4263f07ca3636bf22c64be9610c11", - "reference": "f3ea021866f4263f07ca3636bf22c64be9610c11", + "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/11d4235fbc6313ecbf93708606edfd3222e44949", + "reference": "11d4235fbc6313ecbf93708606edfd3222e44949", "shasum": "" }, "require": { "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.11" + "phpstan/phpstan": "^1.12" }, "conflict": { "phpunit/phpunit": "<7.0" @@ -6471,9 +6529,9 @@ "description": "PHPUnit extensions and rules for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-phpunit/issues", - "source": "https://github.com/phpstan/phpstan-phpunit/tree/1.4.0" + "source": "https://github.com/phpstan/phpstan-phpunit/tree/1.4.1" }, - "time": "2024-04-20T06:39:00+00:00" + "time": "2024-11-12T12:43:59+00:00" }, { "name": "phpstan/phpstan-strict-rules", @@ -9417,16 +9475,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.10.3", + "version": "3.11.0", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "62d32998e820bddc40f99f8251958aed187a5c9c" + "reference": "70c08f8d20c0eb4fe56f26644dd94dae76a7f450" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/62d32998e820bddc40f99f8251958aed187a5c9c", - "reference": "62d32998e820bddc40f99f8251958aed187a5c9c", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/70c08f8d20c0eb4fe56f26644dd94dae76a7f450", + "reference": "70c08f8d20c0eb4fe56f26644dd94dae76a7f450", "shasum": "" }, "require": { @@ -9493,7 +9551,7 @@ "type": "open_collective" } ], - "time": "2024-09-18T10:38:58+00:00" + "time": "2024-11-12T09:53:29+00:00" }, { "name": "symfony/config", @@ -9572,16 +9630,16 @@ }, { "name": "symfony/console", - "version": "v6.4.14", + "version": "v6.4.15", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "897c2441ed4eec8a8a2c37b943427d24dba3f26b" + "reference": "f1fc6f47283e27336e7cebb9e8946c8de7bff9bd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/897c2441ed4eec8a8a2c37b943427d24dba3f26b", - "reference": "897c2441ed4eec8a8a2c37b943427d24dba3f26b", + "url": "https://api.github.com/repos/symfony/console/zipball/f1fc6f47283e27336e7cebb9e8946c8de7bff9bd", + "reference": "f1fc6f47283e27336e7cebb9e8946c8de7bff9bd", "shasum": "" }, "require": { @@ -9646,7 +9704,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.4.14" + "source": "https://github.com/symfony/console/tree/v6.4.15" }, "funding": [ { @@ -9662,20 +9720,20 @@ "type": "tidelift" } ], - "time": "2024-11-05T15:34:40+00:00" + "time": "2024-11-06T14:19:14+00:00" }, { "name": "symfony/dependency-injection", - "version": "v7.1.6", + "version": "v7.1.8", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "1f12f9d580ef8dd09e3b756aa111cc2d5f311bfd" + "reference": "e4d13f0f394f4d02a041ff76acd31c5a20a5f70b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/1f12f9d580ef8dd09e3b756aa111cc2d5f311bfd", - "reference": "1f12f9d580ef8dd09e3b756aa111cc2d5f311bfd", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/e4d13f0f394f4d02a041ff76acd31c5a20a5f70b", + "reference": "e4d13f0f394f4d02a041ff76acd31c5a20a5f70b", "shasum": "" }, "require": { @@ -9726,7 +9784,7 @@ "description": "Allows you to standardize and centralize the way objects are constructed in your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dependency-injection/tree/v7.1.6" + "source": "https://github.com/symfony/dependency-injection/tree/v7.1.8" }, "funding": [ { @@ -9742,7 +9800,7 @@ "type": "tidelift" } ], - "time": "2024-10-25T15:11:02+00:00" + "time": "2024-11-09T09:16:45+00:00" }, { "name": "symfony/deprecation-contracts", @@ -10490,16 +10548,16 @@ }, { "name": "symfony/process", - "version": "v7.1.7", + "version": "v7.1.8", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "9b8a40b7289767aa7117e957573c2a535efe6585" + "reference": "42783370fda6e538771f7c7a36e9fa2ee3a84892" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/9b8a40b7289767aa7117e957573c2a535efe6585", - "reference": "9b8a40b7289767aa7117e957573c2a535efe6585", + "url": "https://api.github.com/repos/symfony/process/zipball/42783370fda6e538771f7c7a36e9fa2ee3a84892", + "reference": "42783370fda6e538771f7c7a36e9fa2ee3a84892", "shasum": "" }, "require": { @@ -10531,7 +10589,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v7.1.7" + "source": "https://github.com/symfony/process/tree/v7.1.8" }, "funding": [ { @@ -10547,7 +10605,7 @@ "type": "tidelift" } ], - "time": "2024-11-06T09:25:12+00:00" + "time": "2024-11-06T14:23:19+00:00" }, { "name": "symfony/property-access", @@ -10627,16 +10685,16 @@ }, { "name": "symfony/property-info", - "version": "v7.1.6", + "version": "v7.1.8", "source": { "type": "git", "url": "https://github.com/symfony/property-info.git", - "reference": "6b630ff585d9fdc72f50369885ad4364a849cf02" + "reference": "3748f85f64351d282fd028e44309856f1d79142e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/property-info/zipball/6b630ff585d9fdc72f50369885ad4364a849cf02", - "reference": "6b630ff585d9fdc72f50369885ad4364a849cf02", + "url": "https://api.github.com/repos/symfony/property-info/zipball/3748f85f64351d282fd028e44309856f1d79142e", + "reference": "3748f85f64351d282fd028e44309856f1d79142e", "shasum": "" }, "require": { @@ -10652,7 +10710,7 @@ }, "require-dev": { "phpdocumentor/reflection-docblock": "^5.2", - "phpstan/phpdoc-parser": "^1.0", + "phpstan/phpdoc-parser": "^1.0|^2.0", "symfony/cache": "^6.4|^7.0", "symfony/dependency-injection": "^6.4|^7.0", "symfony/serializer": "^6.4|^7.0" @@ -10691,7 +10749,7 @@ "validator" ], "support": { - "source": "https://github.com/symfony/property-info/tree/v7.1.6" + "source": "https://github.com/symfony/property-info/tree/v7.1.8" }, "funding": [ { @@ -10707,20 +10765,20 @@ "type": "tidelift" } ], - "time": "2024-09-25T14:20:29+00:00" + "time": "2024-11-09T07:07:11+00:00" }, { "name": "symfony/serializer", - "version": "v7.1.6", + "version": "v7.1.8", "source": { "type": "git", "url": "https://github.com/symfony/serializer.git", - "reference": "537f125ed7ddb8fffac34a83dfd6905e044ca76f" + "reference": "6066de113408496e1e3d4bf9e21fb209d344768b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/serializer/zipball/537f125ed7ddb8fffac34a83dfd6905e044ca76f", - "reference": "537f125ed7ddb8fffac34a83dfd6905e044ca76f", + "url": "https://api.github.com/repos/symfony/serializer/zipball/6066de113408496e1e3d4bf9e21fb209d344768b", + "reference": "6066de113408496e1e3d4bf9e21fb209d344768b", "shasum": "" }, "require": { @@ -10741,7 +10799,7 @@ }, "require-dev": { "phpdocumentor/reflection-docblock": "^3.2|^4.0|^5.0", - "phpstan/phpdoc-parser": "^1.0", + "phpstan/phpdoc-parser": "^1.0|^2.0", "seld/jsonlint": "^1.10", "symfony/cache": "^6.4|^7.0", "symfony/config": "^6.4|^7.0", @@ -10790,7 +10848,7 @@ "description": "Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/serializer/tree/v7.1.6" + "source": "https://github.com/symfony/serializer/tree/v7.1.8" }, "funding": [ { @@ -10806,7 +10864,7 @@ "type": "tidelift" } ], - "time": "2024-10-09T08:46:59+00:00" + "time": "2024-11-09T09:16:45+00:00" }, { "name": "symfony/service-contracts", @@ -10955,16 +11013,16 @@ }, { "name": "symfony/string", - "version": "v7.1.6", + "version": "v7.1.8", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "61b72d66bf96c360a727ae6232df5ac83c71f626" + "reference": "591ebd41565f356fcd8b090fe64dbb5878f50281" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/61b72d66bf96c360a727ae6232df5ac83c71f626", - "reference": "61b72d66bf96c360a727ae6232df5ac83c71f626", + "url": "https://api.github.com/repos/symfony/string/zipball/591ebd41565f356fcd8b090fe64dbb5878f50281", + "reference": "591ebd41565f356fcd8b090fe64dbb5878f50281", "shasum": "" }, "require": { @@ -11022,7 +11080,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v7.1.6" + "source": "https://github.com/symfony/string/tree/v7.1.8" }, "funding": [ { @@ -11038,7 +11096,7 @@ "type": "tidelift" } ], - "time": "2024-09-25T14:20:29+00:00" + "time": "2024-11-13T13:31:21+00:00" }, { "name": "symfony/translation-contracts", @@ -11120,16 +11178,16 @@ }, { "name": "symfony/type-info", - "version": "v7.1.6", + "version": "v7.1.8", "source": { "type": "git", "url": "https://github.com/symfony/type-info.git", - "reference": "a13032128c307470955c45c99201349b15cd7f4a" + "reference": "51535dde21c7abf65c9d000a30bb15f6478195e6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/type-info/zipball/a13032128c307470955c45c99201349b15cd7f4a", - "reference": "a13032128c307470955c45c99201349b15cd7f4a", + "url": "https://api.github.com/repos/symfony/type-info/zipball/51535dde21c7abf65c9d000a30bb15f6478195e6", + "reference": "51535dde21c7abf65c9d000a30bb15f6478195e6", "shasum": "" }, "require": { @@ -11142,7 +11200,7 @@ "symfony/property-info": "<6.4" }, "require-dev": { - "phpstan/phpdoc-parser": "^1.0", + "phpstan/phpdoc-parser": "^1.0|^2.0", "symfony/dependency-injection": "^6.4|^7.0", "symfony/property-info": "^6.4|^7.0" }, @@ -11182,7 +11240,7 @@ "type" ], "support": { - "source": "https://github.com/symfony/type-info/tree/v7.1.6" + "source": "https://github.com/symfony/type-info/tree/v7.1.8" }, "funding": [ { @@ -11198,20 +11256,20 @@ "type": "tidelift" } ], - "time": "2024-09-25T14:20:29+00:00" + "time": "2024-11-07T15:49:33+00:00" }, { "name": "symfony/validator", - "version": "v7.1.7", + "version": "v7.1.8", "source": { "type": "git", "url": "https://github.com/symfony/validator.git", - "reference": "7ec52f844ee39f6d8120e421df75b972deff29eb" + "reference": "85a90c0a4ab0d10c118d3cdf39115e00d9cca7d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/validator/zipball/7ec52f844ee39f6d8120e421df75b972deff29eb", - "reference": "7ec52f844ee39f6d8120e421df75b972deff29eb", + "url": "https://api.github.com/repos/symfony/validator/zipball/85a90c0a4ab0d10c118d3cdf39115e00d9cca7d0", + "reference": "85a90c0a4ab0d10c118d3cdf39115e00d9cca7d0", "shasum": "" }, "require": { @@ -11279,7 +11337,7 @@ "description": "Provides tools to validate values", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/validator/tree/v7.1.7" + "source": "https://github.com/symfony/validator/tree/v7.1.8" }, "funding": [ { @@ -11295,7 +11353,7 @@ "type": "tidelift" } ], - "time": "2024-11-04T11:34:07+00:00" + "time": "2024-11-08T15:46:42+00:00" }, { "name": "symfony/var-exporter", @@ -11947,24 +12005,24 @@ }, { "name": "wyrihaximus/coding-standard", - "version": "2.14.0", + "version": "2.15.0", "source": { "type": "git", "url": "https://github.com/WyriHaximus/php-coding-standard.git", - "reference": "7530678d70ced4d41540df0e60e8811d14813058" + "reference": "a855f23a23ffd01adedc619c000d6e1e7eba19de" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/WyriHaximus/php-coding-standard/zipball/7530678d70ced4d41540df0e60e8811d14813058", - "reference": "7530678d70ced4d41540df0e60e8811d14813058", + "url": "https://api.github.com/repos/WyriHaximus/php-coding-standard/zipball/a855f23a23ffd01adedc619c000d6e1e7eba19de", + "reference": "a855f23a23ffd01adedc619c000d6e1e7eba19de", "shasum": "" }, "require": { "dealerdirect/phpcodesniffer-composer-installer": "^1.0.0", "doctrine/coding-standard": "^12.0.0", - "php": "^8.1", - "slevomat/coding-standard": "^8.11.1", - "squizlabs/php_codesniffer": "^3.7.2" + "php": "^8.2", + "slevomat/coding-standard": "^8.15.0", + "squizlabs/php_codesniffer": "^3.11.0" }, "type": "phpcodesniffer-standard", "notification-url": "https://packagist.org/downloads/", @@ -11974,7 +12032,7 @@ "description": "WyriHaximus Coding Standard", "support": { "issues": "https://github.com/WyriHaximus/php-coding-standard/issues", - "source": "https://github.com/WyriHaximus/php-coding-standard/tree/2.14.0" + "source": "https://github.com/WyriHaximus/php-coding-standard/tree/2.15.0" }, "funding": [ { @@ -11982,7 +12040,7 @@ "type": "github" } ], - "time": "2023-05-06T11:54:10+00:00" + "time": "2024-11-12T13:24:55+00:00" }, { "name": "wyrihaximus/phpstan-rules-wrapper", @@ -12115,6 +12173,7 @@ "openapi-tools/representation": 20, "openapi-tools/utils": 20, "openapi-tools/gatherer": 20, + "openapi-tools/generator-schema": 20, "openapi-tools/test-data": 20 }, "prefer-stable": true, diff --git a/src/Hydrator.php b/src/Hydrator.php index 3e190ea..d8fc376 100644 --- a/src/Hydrator.php +++ b/src/Hydrator.php @@ -64,7 +64,7 @@ public function generate(Package $package, Representation\Namespaced\Representat $schemaClasses = []; foreach ($hydrators as $hydrator) { foreach ($hydrator->schemas as $schema) { - $schemaClasses[] = $schema->className->fullyQualified->source; + $schemaClasses[] = trim($schema->className->fullyQualified->source, '\\'); } yield new File( diff --git a/tests/DataTests/Aliases.php b/tests/DataTests/Aliases.php index cf6249e..02f07d0 100644 --- a/tests/DataTests/Aliases.php +++ b/tests/DataTests/Aliases.php @@ -12,5 +12,25 @@ final class Aliases extends TestCase public static function assert(File ...$files): void { self::assertCount(2, $files); + + self::assertArrayHasKey('Internal\Hydrators', $files); + self::assertArrayHasKey('Internal\Hydrator\Operation\Root', $files); + + self::assertStringNotContainsString('namespace \\', $files['Internal\Hydrators']->contents); + self::assertStringContainsString('public function hydrateObject(string $className, array $payload) : object', $files['Internal\Hydrators']->contents); + self::assertStringContainsString('public function hydrateObjects(string $className, iterable $payloads) : \EventSauce\ObjectHydrator\IterableList', $files['Internal\Hydrators']->contents); + self::assertStringContainsString('public function serializeObject(object $object) : mixed', $files['Internal\Hydrators']->contents); + self::assertStringContainsString('public function serializeObjects(iterable $payloads) : \EventSauce\ObjectHydrator\IterableList', $files['Internal\Hydrators']->contents); + self::assertStringContainsString('public function getObjectMapperOperation🌀Root() : \ApiClients\Client\GitHub\Aliases\Internal\Hydrator\Operation\Root', $files['Internal\Hydrators']->contents); + self::assertStringContainsString('final class Hydrators implements \EventSauce\ObjectHydrator\ObjectMapper', $files['Internal\Hydrators']->contents); + + self::assertStringNotContainsString('namespace \\', $files['Internal\Hydrator\Operation\Root']->contents); + self::assertStringContainsString('public function hydrateObject(string $className, array $payload): object', $files['Internal\Hydrator\Operation\Root']->contents); + self::assertStringContainsString('public function hydrateObjects(string $className, iterable $payloads): IterableList', $files['Internal\Hydrator\Operation\Root']->contents); + self::assertStringContainsString('public function serializeObject(object $object): mixed', $files['Internal\Hydrator\Operation\Root']->contents); + self::assertStringContainsString('public function serializeObjects(iterable $payloads): IterableList', $files['Internal\Hydrator\Operation\Root']->contents); + self::assertStringContainsString('class Root implements ObjectMapper', $files['Internal\Hydrator\Operation\Root']->contents); + self::assertStringContainsString('\'Ramsey\Uuid\UuidInterface\' => $this->serializeValueRamsey⚡️Uuid⚡️UuidInterface($object),', $files['Internal\Hydrator\Operation\Root']->contents); + self::assertStringContainsString('(array $payload): \\\\ApiClients\Client\GitHub\Aliases\Schema\Root', $files['Internal\Hydrator\Operation\Root']->contents); } } diff --git a/tests/DataTests/Basic.php b/tests/DataTests/Basic.php index 665b6be..290246c 100644 --- a/tests/DataTests/Basic.php +++ b/tests/DataTests/Basic.php @@ -21,7 +21,7 @@ public static function assert(File ...$files): void self::assertStringContainsString('public function hydrateObjects(string $className, iterable $payloads) : \EventSauce\ObjectHydrator\IterableList', $files['Internal\Hydrators']->contents); self::assertStringContainsString('public function serializeObject(object $object) : mixed', $files['Internal\Hydrators']->contents); self::assertStringContainsString('public function serializeObjects(iterable $payloads) : \EventSauce\ObjectHydrator\IterableList', $files['Internal\Hydrators']->contents); - self::assertStringContainsString('public function getObjectMapperOperation🌀Root() : \ApiClients\Client\GitHub\Internal\Hydrator\Operation\Root', $files['Internal\Hydrators']->contents); + self::assertStringContainsString('public function getObjectMapperOperation🌀Root() : \ApiClients\Client\GitHub\Basic\Internal\Hydrator\Operation\Root', $files['Internal\Hydrators']->contents); self::assertStringContainsString('final class Hydrators implements \EventSauce\ObjectHydrator\ObjectMapper', $files['Internal\Hydrators']->contents); self::assertStringNotContainsString('namespace \\', $files['Internal\Hydrator\Operation\Root']->contents); @@ -31,5 +31,6 @@ public static function assert(File ...$files): void self::assertStringContainsString('public function serializeObjects(iterable $payloads): IterableList', $files['Internal\Hydrator\Operation\Root']->contents); self::assertStringContainsString('class Root implements ObjectMapper', $files['Internal\Hydrator\Operation\Root']->contents); self::assertStringContainsString('\'Ramsey\Uuid\UuidInterface\' => $this->serializeValueRamsey⚡️Uuid⚡️UuidInterface($object),', $files['Internal\Hydrator\Operation\Root']->contents); +// self::assertStringContainsString('(array $payload): \\\\ApiClients\Client\GitHub\Schema\Root', $files['Internal\Hydrator\Operation\Root']->contents); } } diff --git a/tests/HydratorTest.php b/tests/HydratorTest.php index 64aacfb..6136a3a 100644 --- a/tests/HydratorTest.php +++ b/tests/HydratorTest.php @@ -9,6 +9,7 @@ use OpenAPITools\Configuration\Package; use OpenAPITools\Gatherer\Gatherer; use OpenAPITools\Generator\Hydrator\Hydrator; +use OpenAPITools\Generator\Schema\Schema; use OpenAPITools\Representation\Representation; use OpenAPITools\TestData\DataSet; use OpenAPITools\TestData\Provider; @@ -59,8 +60,8 @@ public function gather(DataSet $dataSet): void 'tests', ), new Namespace_( - 'ApiClients\Client\GitHub', - 'ApiClients\Tests\Client\GitHub', + 'ApiClients\Client\GitHub\\' . $dataSet->name, + 'ApiClients\Tests\Client\GitHub\\' . $dataSet->name, ), new Package\QA( phpcs: new Package\QA\Tool(true, null), @@ -79,8 +80,19 @@ public function gather(DataSet $dataSet): void [], ); - $files = []; - $generatedFiles = (new Hydrator(new BuilderFactory()))->generate($package, $representation->namespace($package->namespace)); + $files = []; + $buildFactory = new BuilderFactory(); + foreach ((new Schema($buildFactory))->generate($package, $representation->namespace($package->namespace)) as $file) { + /** @phpstan-ignore-next-line */ + eval((new Standard())->prettyPrint([ + new Node\Stmt\Declare_([ + new Node\Stmt\DeclareDeclare('strict_types', new Node\Scalar\LNumber(1)), + ]), + $file->contents, + ])); + } + + $generatedFiles = (new Hydrator($buildFactory))->generate($package, $representation->namespace($package->namespace)); foreach ($generatedFiles as $generatedFile) { $files[$generatedFile->fqcn] = new File(