diff --git a/src/Writing/Writer.php b/src/Writing/Writer.php index c3a03539..2fae7bbf 100644 --- a/src/Writing/Writer.php +++ b/src/Writing/Writer.php @@ -2,6 +2,7 @@ namespace Knuckles\Scribe\Writing; +use Illuminate\Support\Arr; use Illuminate\Support\Facades\Storage; use Knuckles\Scribe\Tools\ConsoleOutputUtils as c; use Knuckles\Scribe\Tools\DocumentationConfig; @@ -127,7 +128,7 @@ public function generatePostmanCollection(array $groupedEndpoints): string $writer = app()->makeWith(PostmanCollectionWriter::class, ['config' => $this->config]); $collection = $writer->generatePostmanCollection($groupedEndpoints); - $overrides = $this->config->get('postman.overrides', []); + $overrides = Arr::dot($this->config->get('postman.overrides', [])); if (count($overrides)) { foreach ($overrides as $key => $value) { data_set($collection, $key, $value); @@ -147,7 +148,7 @@ public function generateOpenAPISpec(array $groupedEndpoints): string $writer = app()->makeWith(OpenAPISpecWriter::class, ['config' => $this->config]); $spec = $writer->generateSpecContent($groupedEndpoints); - $overrides = $this->config->get('openapi.overrides', []); + $overrides = Arr::dot($this->config->get('openapi.overrides', [])); if (count($overrides)) { foreach ($overrides as $key => $value) { data_set($spec, $key, $value); diff --git a/tests/Fixtures/collection.json b/tests/Fixtures/collection.json index ccf3d58d..2de58bf4 100644 --- a/tests/Fixtures/collection.json +++ b/tests/Fixtures/collection.json @@ -13,7 +13,8 @@ "_postman_id": "", "description": "", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", - "version": "3.9.9" + "version": "3.9.9", + "termsOfService": "http://api.api.dev/terms-of-service" }, "item": [ { diff --git a/tests/Fixtures/openapi.yaml b/tests/Fixtures/openapi.yaml index 9ea3a135..8cfbce08 100644 --- a/tests/Fixtures/openapi.yaml +++ b/tests/Fixtures/openapi.yaml @@ -3,6 +3,7 @@ info: title: Laravel description: '' version: 3.9.9 + termsOfService: "http://api.api.dev/terms-of-service" servers: - url: 'http://localhost' diff --git a/tests/GenerateDocumentation/OutputTest.php b/tests/GenerateDocumentation/OutputTest.php index 28e41a34..3e948797 100644 --- a/tests/GenerateDocumentation/OutputTest.php +++ b/tests/GenerateDocumentation/OutputTest.php @@ -187,6 +187,9 @@ public function generated_postman_collection_file_is_correct() config(['scribe.auth.enabled' => true]); config(['scribe.postman.overrides' => [ 'info.version' => '3.9.9', + 'info' => [ + 'termsOfService' => 'http://api.api.dev/terms-of-service', + ], ]]); config([ 'scribe.routes.0.apply.headers' => [ @@ -221,6 +224,9 @@ public function generated_openapi_spec_file_is_correct() config(['scribe.openapi.enabled' => true]); config(['scribe.openapi.overrides' => [ 'info.version' => '3.9.9', + 'info' => [ + 'termsOfService' => 'http://api.api.dev/terms-of-service', + ], ]]); config([ 'scribe.routes.0.apply.headers' => [