Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

* When not using dot notation, overrides no longer remove all the ch… #728

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/Writing/Writer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion tests/Fixtures/collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
{
Expand Down
1 change: 1 addition & 0 deletions tests/Fixtures/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ info:
title: Laravel
description: ''
version: 3.9.9
termsOfService: "http://api.api.dev/terms-of-service"
servers:
-
url: 'http://localhost'
Expand Down
6 changes: 6 additions & 0 deletions tests/GenerateDocumentation/OutputTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => [
Expand Down Expand Up @@ -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' => [
Expand Down
Loading