From bf7f1c12d20a5c03e63454e96e3738ef2e49702e Mon Sep 17 00:00:00 2001 From: Viacheslav Poturaev Date: Thu, 22 Jul 2021 15:55:57 +0200 Subject: [PATCH] Fix missing response decoding due to exception during code generation for enum (#32) --- CHANGELOG.md | 10 ++++++++++ composer.json | 2 +- composer.lock | 15 ++++++++------- .../Template/Response/ResponseCodeFactory.php | 6 +++--- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 41e6cba..846fe20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.1.26] - 2021-07-22 + +### Fixed +- Missing response decoding due to exception during code generation for enum, [#31](https://github.com/swaggest/swac/issues/31). + +### Added +- Dependencies updated. + ## [0.1.25] - 2021-07-16 ### Added @@ -165,6 +173,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Keep path parameters in operation name of PHP client. +[0.1.26]: https://github.com/swaggest/swac/compare/v0.1.25...v0.1.26 +[0.1.25]: https://github.com/swaggest/swac/compare/v0.1.24...v0.1.25 [0.1.24]: https://github.com/swaggest/swac/compare/v0.1.23...v0.1.24 [0.1.23]: https://github.com/swaggest/swac/compare/v0.1.22...v0.1.23 [0.1.22]: https://github.com/swaggest/swac/compare/v0.1.21...v0.1.22 diff --git a/composer.json b/composer.json index d3958d5..0b3d0ca 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ ], "require": { "swaggest/json-schema": "^0.12.36", - "swaggest/php-code-builder": "^0.2.33", + "swaggest/php-code-builder": "^0.2.34", "swaggest/go-code-builder": "^0.4.45", "swaggest/json-cli": "v1.8.5", "php-yaoi/php-yaoi": "^1", diff --git a/composer.lock b/composer.lock index 8752bce..696e507 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": "0d4660d019fbc0e6a99f7049aa6f3388", + "content-hash": "afe3093dda0f9b64d9856a85fd8f869b", "packages": [ { "name": "bramus/ansi-php", @@ -1046,16 +1046,16 @@ }, { "name": "swaggest/php-code-builder", - "version": "v0.2.33", + "version": "v0.2.34", "source": { "type": "git", "url": "https://github.com/swaggest/php-code-builder.git", - "reference": "7f924e4d202a33e7bd4e80eedab94664955666c7" + "reference": "e172e5e48d0d716adadd2fdbf9657eb1ea23c60e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/swaggest/php-code-builder/zipball/7f924e4d202a33e7bd4e80eedab94664955666c7", - "reference": "7f924e4d202a33e7bd4e80eedab94664955666c7", + "url": "https://api.github.com/repos/swaggest/php-code-builder/zipball/e172e5e48d0d716adadd2fdbf9657eb1ea23c60e", + "reference": "e172e5e48d0d716adadd2fdbf9657eb1ea23c60e", "shasum": "" }, "require": { @@ -1091,9 +1091,9 @@ ], "support": { "issues": "https://github.com/swaggest/php-code-builder/issues", - "source": "https://github.com/swaggest/php-code-builder/tree/v0.2.33" + "source": "https://github.com/swaggest/php-code-builder/tree/v0.2.34" }, - "time": "2021-05-27T14:56:22+00:00" + "time": "2021-07-22T13:40:04+00:00" }, { "name": "swaggest/rest-client", @@ -2941,6 +2941,7 @@ "issues": "https://github.com/sebastianbergmann/resource-operations/issues", "source": "https://github.com/sebastianbergmann/resource-operations/tree/master" }, + "abandoned": true, "time": "2015-07-28T20:34:47+00:00" }, { diff --git a/src/Php/Client/Template/Response/ResponseCodeFactory.php b/src/Php/Client/Template/Response/ResponseCodeFactory.php index 63f92dc..844fc3e 100644 --- a/src/Php/Client/Template/Response/ResponseCodeFactory.php +++ b/src/Php/Client/Template/Response/ResponseCodeFactory.php @@ -5,8 +5,8 @@ use Exception; use GuzzleHttp\Exception\GuzzleException; -use Swac\Log; use Swac\Rest\Response; +use Swac\Skip; use Swaggest\CodeBuilder\PlaceholderString; use Swaggest\JsonSchema\InvalidValue; use Swaggest\JsonSchema\Schema; @@ -143,7 +143,7 @@ public function build() $binds[':statusCode'] = new TypeOf(PhpClass::byFQN(StatusCode::class)); $codeName = $statusCode->phrase; } catch (Exception $e) { - + throw new Skip($e->getMessage()); } } @@ -162,7 +162,7 @@ public function build() $case . ': $result = :type::import($this->getJsonResponse());break;' . "\n", $binds )); } catch (Exception $e) { - Log::getInstance()->error($e->getMessage()); + throw new Skip($e->getMessage()); } } else { $body->addSnippet(new PlaceholderString(