From b8f2ad3b5967ea4548168a49029faa36fd890e2f Mon Sep 17 00:00:00 2001 From: David Fuhr Date: Fri, 1 Jul 2016 09:17:00 +0200 Subject: [PATCH] Only replace basePath if it exists If you split swagger definition up into multiple files not all files will contain a base path --- Controller/StaticResourcesController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Controller/StaticResourcesController.php b/Controller/StaticResourcesController.php index 893b259..0a8e3f7 100644 --- a/Controller/StaticResourcesController.php +++ b/Controller/StaticResourcesController.php @@ -65,7 +65,9 @@ public function apiDeclarationAction(Request $request, $resource) foreach ($files as $file) { $data = json_decode($file->getContents(), true); - $data['basePath'] = $request->getBaseUrl() . $data['basePath']; + if (array_key_exists('basePath', $data)) { + $data['basePath'] = $request->getBaseUrl() . $data['basePath']; + } $response = new JsonResponse($data); return $response; }