Explorar o código

Rename `auth.display_value` to `auth.placeholder`

Shalvah %!s(int64=4) %!d(string=hai) anos
pai
achega
2ce01ae6d1

+ 2 - 2
config/scribe.php

@@ -69,10 +69,10 @@ return [
         'use_value' => env('SCRIBE_AUTH_KEY'),
 
         /*
-         * The value of the parameter to be displayed by Scribe in documentation.
+         * Placeholder your users will see for the auth parameter in the example requests.
          * If this value is null, Scribe will use a random value.
          */
-        'display_value' => null,
+        'placeholder' => '{YOUR_AUTH_KEY}',
 
         /*
          * Any extra authentication-related info for your users. For instance, you can describe how to find or generate their auth credentials.

+ 1 - 1
docs/config.md

@@ -102,7 +102,7 @@ Here are the available settings:
 
 - `use_value`: The value of the parameter to be used by Scribe to authenticate response calls. This will **not** be included in the generated documentation. If this value is null, Scribe will use a random value.
 
-- `display_value`: The value of the parameter that will be included in the generated documentation. If this value is null, Scribe will use a random value.
+- `placeholder`: Placeholder your users will see for the auth parameter in the example requests. If this is empty, Scribe will generate a realistic-looking auth token instead. Defaults to: "{YOUR_AUTH_KEY}".
 
 - `extra_info`: Any extra authentication-related info for your users. For instance, you can describe how to find or generate their auth credentials. Markdown and HTML are supported. This will be included in the `Authentication` section.
 

+ 4 - 4
docs/documenting/documenting-api-information.md

@@ -19,7 +19,7 @@ Here's how you'd configure auth with a query parameter named `apiKey`:
         'in' => 'query',
         'name' => 'apiKey',
         'use_value' => env('SCRIBE_API_KEY'),
-        'display_value' => 'YOUR-API-KEY',
+        'placeholder' => 'YOUR-API-KEY',
         'extra_info' => 'You can retrieve your key by going to settings and clicking <b>Generate API key</b>.',
     ],
 ```
@@ -35,7 +35,7 @@ Here's an example with a bearer token (also applies to basic auth, if you change
         'in' => 'bearer',
         'name' => 'hahaha', // <--- This value is ignored for bearer and basic auth
         'use_value' => env('SCRIBE_AUTH_KEY'),
-        'display_value' => '{ACCESS-TOKEN}',
+        'placeholder' => '{ACCESS_TOKEN}',
         'extra_info' => 'You can retrieve your token by visiting your dashboard and clicking <b>Generate API token</b>.',
     ],
 ```
@@ -49,7 +49,7 @@ And here's an example with a custom header:
         'in' => 'header',
         'name' => 'Api-Key', // <--- The name of the header
         'use_value' => env('SCRIBE_AUTH_KEY'),
-        'display_value' => 'YOUR-API-KEY',
+        'placeholder' => 'YOUR-API-KEY',
         'extra_info' => 'You can retrieve your token by visiting your dashboard and clicking <b>Generate API token</b>.',
     ],
 ```
@@ -57,7 +57,7 @@ And here's an example with a custom header:
 You can set whatever you want as the `extra_info`. A good idea would be to tell your users where to get their auth key. 
 
 The `use_value` field is only used by Scribe for response calls. It won't be included in the generated output or examples.
-The `display_value` is opposite of `use_value`, it will be included in generated output in examples, but it will **not** be used for response calls.
+The `placeholder` is opposite of `use_value`. It will be used only as a placeholder in the generated example requests.
 
 For more information, see the [reference documentation on the auth section](../config.html#auth).
 

+ 1 - 1
src/Extracting/Generator.php

@@ -316,7 +316,7 @@ class Generator
         }
         $token = $faker->shuffle('abcdefghkvaZVDPE1864563');
         $valueToUse = $this->config->get('auth.use_value');
-        $valueToDisplay = $this->config->get('auth.display_value');
+        $valueToDisplay = $this->config->get('auth.placeholder');
         switch ($strategy) {
             case 'query':
             case 'query_or_body':