From 62b681cc3eddd83cd2d55e603d408d115718ba5d Mon Sep 17 00:00:00 2001 From: konradoboza <34310128+konradoboza@users.noreply.github.com> Date: Thu, 20 Sep 2018 15:00:35 +0200 Subject: [PATCH] EZP-29234: As a developer, I want to read about customizing REST API response (#986) * EZP-29234: As a developer, I want to read about customizing REST API response * added dependency to kernel branch, don't merge * set composer to not check via SSH for publish fork * travis setting for using kernel branch --- Resources/config/services.yml | 5 ++++- Rest/Generator/Json.php | 17 ----------------- Tests/Rest/Generator/JsonTest.php | 5 +++-- 3 files changed, 7 insertions(+), 20 deletions(-) delete mode 100644 Rest/Generator/Json.php diff --git a/Resources/config/services.yml b/Resources/config/services.yml index 6a25f68ee..a56eef9ef 100644 --- a/Resources/config/services.yml +++ b/Resources/config/services.yml @@ -52,6 +52,8 @@ parameters: # To disable set to 0. ezsystems.platformui.application_config.combo_loader.cache_ttl: 604800 + ezsystems.platformui.rest.generator.json.vendor: 'vnd.ez.platformui' + ezsystems.platformui.rest.output.visitor.json.regexps: - '(^application/vnd\.ez\.platformui\.[A-Za-z]+\+json$)' services: @@ -282,9 +284,10 @@ services: - { name: ezpublish_rest.field_type_processor, alias: ezuser } ezsystems.platformui.rest.output.generator.json: - class: EzSystems\PlatformUIBundle\Rest\Generator\Json + class: eZ\Publish\Core\REST\Common\Output\Generator\Json arguments: - "@ezpublish_rest.output.generator.json.field_type_hash_generator" + - "%ezsystems.platformui.rest.generator.json.vendor%" calls: - [ setFormatOutput, [ "%kernel.debug%" ] ] diff --git a/Rest/Generator/Json.php b/Rest/Generator/Json.php deleted file mode 100644 index 82eddb05c..000000000 --- a/Rest/Generator/Json.php +++ /dev/null @@ -1,17 +0,0 @@ -getMock(FieldTypeHashGenerator::class)))->getMediaType('Object'); + $vendor = 'vnd.ez.platformui'; + $mediaType = (new Json($this->getMock(FieldTypeHashGenerator::class), $vendor))->getMediaType('Object'); $this->assertEquals('application/vnd.ez.platformui.Object+json', $mediaType); }