Ver código fonte

Changed @resource annotation to @group

Lawrence Agbani 6 anos atrás
pai
commit
7a4602bed7

+ 1 - 1
README.md

@@ -133,7 +133,7 @@ This package uses these resources to generate the API documentation:
 
 This package uses the HTTP controller doc blocks to create a table of contents and show descriptions for your API methods.
 
-Using `@resource` in a doc block prior to each controller is useful as it creates a Group within the API documentation for all methods defined in that controller (rather than listing every method in a single list for all your controllers), but using `@resource` is not required. The short description after the `@resource` should be unique to allow anchor tags to navigate to this section. A longer description can be included below. Custom formatting and `<aside>` tags are also supported. (see the [Documentarian docs](http://marcelpociot.de/documentarian/installation/markdown_syntax))
+Using `@group` in a doc block prior to each controller is useful as it creates a Group within the API documentation for all methods defined in that controller (rather than listing every method in a single list for all your controllers), but using `@resource` is not required. The short description after the `@resource` should be unique to allow anchor tags to navigate to this section. A longer description can be included below. Custom formatting and `<aside>` tags are also supported. (see the [Documentarian docs](http://marcelpociot.de/documentarian/installation/markdown_syntax))
 
 Above each method within the controller you wish to include in your API documentation you should have a doc block. This should include a unique short description as the first entry. An optional second entry can be added with further information. Both descriptions will appear in the API documentation in a different format as shown below.
 

+ 2 - 2
src/Commands/GenerateDocumentation.php

@@ -57,9 +57,9 @@ class GenerateDocumentation extends Command
         }
 
         $parsedRoutes = $this->processRoutes($generator, $routes);
-        $parsedRoutes = collect($parsedRoutes)->groupBy('resource')
+        $parsedRoutes = collect($parsedRoutes)->groupBy('group')
             ->sort(function ($a, $b) {
-                return strcmp($a->first()['resource'], $b->first()['resource']);
+                return strcmp($a->first()['group'], $b->first()['group']);
             });
 
         $this->writeMarkdown($parsedRoutes);

+ 2 - 2
src/Generators/AbstractGenerator.php

@@ -58,7 +58,7 @@ abstract class AbstractGenerator
 
         return [
             'id' => md5($this->getUri($route).':'.implode($this->getMethods($route))),
-            'resource' => $routeGroup,
+            'group' => $routeGroup,
             'title' => $docBlock['short'],
             'description' => $docBlock['long'],
             'methods' => $this->getMethods($route),
@@ -200,7 +200,7 @@ abstract class AbstractGenerator
         if ($comment) {
             $phpdoc = new DocBlock($comment);
             foreach ($phpdoc->getTags() as $tag) {
-                if ($tag->getName() === 'resource') {
+                if ($tag->getName() === 'group') {
                     return $tag->getContent();
                 }
             }