瀏覽代碼

Switch to description rather than postman.description

shalvah 4 年之前
父節點
當前提交
dc356f3f2b
共有 2 個文件被更改,包括 12 次插入7 次删除
  1. 2 6
      docs/generating-documentation.md
  2. 10 1
      src/Writing/PostmanCollectionWriter.php

+ 2 - 6
docs/generating-documentation.md

@@ -23,20 +23,16 @@ You can configure Postman collection generation in the `postman` section of your
 
 - To turn it off, set the `postman.enabled` config option to false.
 
-- To override some fields in the generated collection, set the `postman.overrides` config option to your changes. You can use dot notation to update specific nested fields. For instance, `['info.version' => '2.0.0']` will override the 'version` key in the 'info` object whenever generating.
+- To override fields in the generated collection, set the `postman.overrides` config option to your changes. You can use dot notation to update specific nested fields. For instance, `['info.version' => '2.0.0']` will override the 'version` key in the 'info` object whenever generating.
 
 - The base URL used in the Postman collection is the value of `config('app.url')` by default. To change this, set the value of the `postman.base_url` key.
 
-- The name of the Postman collection will be derived from `config('app.name')` by default. To change this, set the value of the `title` key (not in the `postman` array). This will also set the title for your docs HTML page.
-
-- You can add descriptions and auth information for the collection in the `postman.description` and `postman.auth` keys. 
-
 ## OpenAPI (Swagger) spec generation
 Scribe can also generate an OpenAPI spec file. This is disabled by default. You can configure this in the `openapi` section of your `scribe.php` file.
 
 - To enable it, set the `openapi.enabled` config option to `true`.
 
-- To override some fields in the generated spec, set the `openapi.overrides` config option to your changes. You can use dot notation to update specific nested fields. For instance, `['info.version' => '2.0.0']` will override the 'version` key in the 'info` object whenever generating.
+- To override fields in the generated spec, set the `openapi.overrides` config option to your changes. You can use dot notation to update specific nested fields. For instance, `['info.version' => '2.0.0']` will override the 'version` key in the 'info` object whenever generating.
 
 You can view the generated spec by visiting `public/docs/openapi.yaml` for `static` type, and `<your-app>/docs.openapi` for `laravel` type. This link will also be added to the sidebar of your docs.
 

+ 10 - 1
src/Writing/PostmanCollectionWriter.php

@@ -7,6 +7,7 @@ use Illuminate\Support\Facades\URL;
 use Illuminate\Support\Str;
 use Ramsey\Uuid\Uuid;
 use ReflectionMethod;
+use Knuckles\Scribe\Tools\ConsoleOutputUtils as c;
 
 class PostmanCollectionWriter
 {
@@ -45,12 +46,20 @@ class PostmanCollectionWriter
 
     public function generatePostmanCollection()
     {
+        $description = config('scribe.postman.description', '');
+
+        if ($description) {
+            c::deprecated('the config key postman.description', 'description');
+        } else {
+            $description = config('scribe.description', '');
+        }
+
         $collection = [
             'variables' => [],
             'info' => [
                 'name' => config('scribe.title') ?: config('app.name') . ' API',
                 '_postman_id' => Uuid::uuid4()->toString(),
-                'description' => config('scribe.postman.description') ?: '',
+                'description' => $description,
                 'schema' => 'https://schema.getpostman.com/json/collection/v2.0.0/collection.json',
             ],
             'item' => $this->routeGroups->map(function (Collection $routes, $groupName) {