Explorar el Código

Highlight that auth params are only added to response calls for authenticated endpoints

shalvah hace 5 años
padre
commit
ca8f791faa

+ 7 - 3
docs/documenting/documenting-api-information.md

@@ -1,10 +1,14 @@
 # Adding general information about your API
 
 ## Authentication information
-You can add authentication information for your API using the `auth` section in `scribe.php`. Scribe will use this in three places:
+You can add authentication information for your API using the `auth` section in `scribe.php`. 
+
+```eval_rst
+.. Important:: Scribe uses your specified authentication information in three places:
 - Generating an "Authentication" section in your docs
-- Adding authentication parameters to your example requests (for endpoints marked as `authenticated`)
-- Setting authentication information for response calls.
+- Adding authentication parameters to your example requests (only for endpoints marked as `@authenticated`)
+- Adding the necessary auth parameters with the specified value to response calls (only for endpoints marked as `@authenticated`)
+```
 
 Here's how you'd configure auth with a query parameter named `apiKey`:
 

+ 1 - 3
src/Extracting/Generator.php

@@ -291,7 +291,7 @@ class Generator
         Arr::set($cleanParams, str_replace(['.*', '*.'], ['.0','0.'], $paramName), $paramExample);
     }
 
-    public function addAuthField(array $parsedRoute)
+    public function addAuthField(array $parsedRoute): array
     {
         $parsedRoute['auth'] = null;
         $isApiAuthed = $this->config->get('auth.enabled', false);
@@ -344,7 +344,5 @@ class Generator
         }
 
         return $parsedRoute;
-
-
     }
 }