瀏覽代碼

Tweaks and improvements

shalvah 5 年之前
父節點
當前提交
e280e84cc1

+ 3 - 1
resources/views/authentication.blade.php

@@ -3,5 +3,7 @@
 @if(!$isAuthed)
 This API is not authenticated.
 @else
-{!! $text !!}
+{!! $authDescription !!}
+
+{!! $extraAuthInfo !!}
 @endif

+ 0 - 0
resources/views/components/field-description.blade.php → resources/views/components/field-details.blade.php


+ 0 - 16
resources/views/errors.blade.php

@@ -1,16 +0,0 @@
-# Error Codes
-
-This API uses the following error codes:
-
-Error Code | Meaning
----------- | -------
-400 | Bad Request -- Your request is invalid.
-401 | Unauthorized -- Your API key is wrong.
-403 | Forbidden
-404 | Not Found
-405 | Method Not Allowed
-406 | Not Acceptable -- You requested a format that isn't json.
-429 | Too Many Requests
-500 | Internal Server Error -- We had a problem with our server. Try again later.
-503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later.
-

+ 1 - 1
resources/views/index.blade.php

@@ -4,4 +4,4 @@
 
 # Introduction
 
-{!! $text !!}
+{!! $introText !!}

+ 1 - 1
resources/views/partials/example-requests/php.blade.php

@@ -14,7 +14,7 @@ $response = $client->{{ strtolower($route['methods'][0]) }}(
 @if(count($route['fileParameters']))
         'multipart' => [
 @foreach($route['cleanBodyParameters'] as $parameter => $value)
-@foreach( \Knuckles\Scribe\Tools\WritingUtils::getParameterNamesAndValuesForFormData($parameter,$value) as $key => $actualValue)
+@foreach(\Knuckles\Scribe\Tools\WritingUtils::getParameterNamesAndValuesForFormData($parameter,$value) as $key => $actualValue)
             [
                 'name' => '{!! $key !!}',
                 'contents' => '{!! $actualValue !!}'

+ 4 - 4
resources/views/partials/route.blade.php

@@ -36,7 +36,7 @@ Binary data - {{ str_replace("<<binary>>","",$response['content']) }}
 @if(count($route['urlParameters']))
 <h4 class="fancy-heading-panel"><b>URL Parameters</b></h4>
 @foreach($route['urlParameters'] as $attribute => $parameter)
-@component('scribe::components.field-description', [
+@component('scribe::components.field-details', [
   'name' => $attribute,
   'type' => null,
   'required' => $parameter['required'] ?? true,
@@ -48,7 +48,7 @@ Binary data - {{ str_replace("<<binary>>","",$response['content']) }}
 @if(count($route['queryParameters']))
 <h4 class="fancy-heading-panel"><b>Query Parameters</b></h4>
 @foreach($route['queryParameters'] as $attribute => $parameter)
-@component('scribe::components.field-description', [
+@component('scribe::components.field-details', [
   'name' => $attribute,
   'type' => null,
   'required' => $parameter['required'] ?? true,
@@ -60,7 +60,7 @@ Binary data - {{ str_replace("<<binary>>","",$response['content']) }}
 @if(count($route['bodyParameters']))
 <h4 class="fancy-heading-panel"><b>Body Parameters</b></h4>
 @foreach($route['bodyParameters'] as $attribute => $parameter)
-@component('scribe::components.field-description', [
+@component('scribe::components.field-details', [
   'name' => $attribute,
   'type' => $parameter['type'] ?? null,
   'required' => $parameter['required'] ?? true,
@@ -73,7 +73,7 @@ Binary data - {{ str_replace("<<binary>>","",$response['content']) }}
 @if(count($route['responseFields'] ?? []))
 <h4 class="fancy-heading-panel"><b>Response Fields</b></h4>
 @foreach($route['responseFields'] as $field)
-@component('scribe::components.field-description', [
+@component('scribe::components.field-details', [
   'name' => $field['name'],
   'type' => $field['type'],
   'required' => true,

+ 7 - 3
src/Writing/Writer.php

@@ -224,7 +224,7 @@ class Writer
         $introText = $this->config->get('intro_text', '');
         $introMarkdown = view('scribe::index')
             ->with('frontmatter', $frontmatter)
-            ->with('text', $introText);
+            ->with('introText', $introText);
         $this->writeFile($indexFile, $introMarkdown);
     }
 
@@ -232,6 +232,7 @@ class Writer
     {
         $isAuthed = $this->config->get('auth.enabled', false);
         $text = '';
+        $extraInfo = '';
 
         if ($isAuthed) {
             $strategy = $this->config->get('auth.in');
@@ -262,10 +263,13 @@ class Writer
                     break;
             }
             $extraInfo = $this->config->get('auth.extra_info', '');
-            $text .= " $extraInfo";
         }
 
-        $authMarkdown = view('scribe::authentication', ['isAuthed' => $isAuthed, 'text' => $text]);
+        $authMarkdown = view('scribe::authentication', [
+            'isAuthed' => $isAuthed,
+            'authDescription' => $text,
+            'extraAuthInfo' => $extraInfo,
+        ]);
         $this->writeFile($this->sourceOutputPath . '/authentication.md', $authMarkdown);
     }
 

+ 3 - 1
todo.md

@@ -1,7 +1,6 @@
 # Documentation tasks
 - Rewritten docs. Some things to document:
   - hideFromAPIDocumentation
-  - overwriting with --force
   - binary responses
   - plugin api: responses - description, $stage property, scribe:strategy
   - --env
@@ -12,7 +11,10 @@
 - Port recent changes from old repo
 
 # Features
+- @header
+- --no-extraction
 - Possible feature: https://github.com/mpociot/laravel-apidoc-generator/issues/731
+- file input python
 
 # Fixes
 - When groups are removed, the markdown files persist, so they remain in the doc