Commit 1c6c4926 authored by Jacob Priddy's avatar Jacob Priddy 👌

fix api route generation to work with scribe v2

parent 49476567
......@@ -19,6 +19,5 @@ DB_PASSWORD=secret
SAML_SIMPLESAMLPHP_AUTOLOAD=/var/simplesamlphp/lib/_autoload.php
SAML_SIMPLESAMLPHP_AUTH_SOURCE=default-sp
FRONTEND_URL=https://localhost:8080
SUPPORT_EMAIL="Support email not configured"
<?php
namespace App\Docs\Strategies;
use Illuminate\Routing\Route;
use Knuckles\Scribe\Extracting\ParamHelpers;
use Knuckles\Scribe\Extracting\RouteDocBlocker;
use Knuckles\Scribe\Extracting\Strategies\Strategy;
use ReflectionClass;
use ReflectionFunctionAbstract;
class test extends Strategy
{
/**
* The stage the strategy belongs to.
* One of "metadata", "urlParameters", "queryParameters", "bodyParameters", "headers", "responses", "responseFields".
*/
public $stage = 'responses';
/**
* Trait containing some helper methods for dealing with "parameters".
* Useful if your strategy extracts information about parameters.
*/
use ParamHelpers;
/**
* @link https://scribe.readthedocs.io/en/latest/plugins.html
* @param Route $route The route which we are currently extracting responses for.
* @param ReflectionClass $controller The class handling the current route.
* @param ReflectionFunctionAbstract $method The method/closure handling the current route.
* @param array $routeRules Array of rules for the ruleset which this route belongs to.
* @param array $alreadyExtractedData Data already extracted from previous stages and earlier strategies in this stage
*
* See the documentation linked above for more details about writing custom strategies.
*
* @return array|null
*/
public function __invoke(
Route $route,
ReflectionClass $controller,
ReflectionFunctionAbstract $method,
array $routeRules,
array $alreadyExtractedData = []
)
{
return null;
}
}
<?php
namespace App\Documentation\Strategies;
use ReflectionClass;
use Illuminate\Routing\Route;
use ReflectionFunctionAbstract;
use Knuckles\Scribe\Tools\DocumentationConfig;
use Knuckles\Scribe\Extracting\Strategies\Strategy;
class ApplicationRepositoryResetStrategy extends Strategy
{
public $stage = 'responses';
public function __construct(DocumentationConfig $config)
{
// Set the config to use in memory implementations
config(['app.env', 'memory']);
parent::__construct($config);
}
/**
* @inheritDoc
*/
public function __invoke(Route $route, ReflectionClass $controller, ReflectionFunctionAbstract $method, array $routeRules, array $alreadyExtractedData = [])
{
return null;
}
}
......@@ -235,10 +235,8 @@ class DoorsController extends ApiController
*
* This endpoint attaches a list of doors to a list of groups by ids.
*
* @bodyParam door_ids[0] string[] required The list of door Ids to attach to. Example: 2
* @bodyParam door_ids[1] string[] required The list of door Ids to attach to. Example: 1
* @bodyParam group_ids[0] string[] required The list of group Ids to attach to. Example: 8
* @bodyParam group_ids[1] string[] required The list of group Ids to attach to. Example: 7
* @bodyParam door_ids string[] required The list of door Ids to attach to. Example: [2, 1]
* @bodyParam group_ids string[] required The list of group Ids to attach to. Example: [8, 7]
*
* @param \Source\UseCases\DoorGroup\AddDoorToGroup\AddDoorToGroupUseCase $addDoorToGroup
* @return \Illuminate\Http\JsonResponse
......@@ -271,10 +269,8 @@ class DoorsController extends ApiController
*
* This endpoint removes a list of doors from a list of groups by ids.
*
* @bodyParam door_ids[0] string[] required The list of door Ids to attach to. Example: 2
* @bodyParam door_ids[1] string[] required The list of door Ids to attach to. Example: 1
* @bodyParam group_ids[0] string[] required The list of group Ids to attach to. Example: 8
* @bodyParam group_ids[1] string[] required The list of group Ids to attach to. Example: 7
* @bodyParam door_ids string[] required The list of door Ids to attach to. Example: [1, 2]
* @bodyParam group_ids string[] required The list of group Ids to attach to. Example: [8, 7]
*
* @param \Source\UseCases\DoorGroup\RemoveDoorFromGroup\RemoveDoorFromGroupUseCase $removeDoorFromGroup
* @return \Illuminate\Http\JsonResponse
......
......@@ -26,10 +26,8 @@ class GroupScheduleController extends ApiController
*
* Attaches groups to schedules.
*
* @bodyParam schedules[0] string[] required The list of schedule Ids to attach to. Example: 1
* @bodyParam schedules[1] string[] required The list of schedule Ids to attach to. Example: 2
* @bodyParam groups[0] string[] required The list of group Ids to attach to. Example: 7
* @bodyParam groups[1] string[] required The list of group Ids to attach to. Example: 8
* @bodyParam schedules string[] required The list of schedule Ids to attach to. Example: [1, 2]
* @bodyParam groups string[] required The list of group Ids to attach to. Example: [7, 8]
*
* @param \Source\UseCases\GroupSchedule\AddSchedulesToGroups\AddSchedulesToGroupsUseCase $useCase
* @return \Illuminate\Http\JsonResponse
......@@ -110,10 +108,8 @@ class GroupScheduleController extends ApiController
*
* Detaches groups from schedules.
*
* @bodyParam schedules[0] string[] required The list of schedule Ids to attach to. Example: 1
* @bodyParam schedules[1] string[] required The list of schedule Ids to attach to. Example: 2
* @bodyParam groups[0] string[] required The list of group Ids to attach to. Example: 7
* @bodyParam groups[1] string[] required The list of group Ids to attach to. Example: 8
* @bodyParam schedules string[] required The list of schedule Ids to attach to. Example: [1, 2]
* @bodyParam groups string[] required The list of group Ids to attach to. Example: [7, 8]
*
* @param \Source\UseCases\GroupSchedule\RemoveSchedulesFromGroups\RemoveSchedulesFromGroupsUseCase $useCase
* @return \Illuminate\Http\JsonResponse
......
......@@ -154,6 +154,7 @@ class GroupsController extends ApiController
* This route updates a group stored in the system. Title's must be unique. Default permission group's titles cannot
* be modified.
*
* @urlParam groupId required The ID of the group to get all information from. Example: 1
* @bodyParam title string required The new title of the group.
* @bodyParam description string required The new group description.
*
......
......@@ -177,8 +177,7 @@ class SchedulesController extends ApiController
*
* This endpoint deletes the given list of schedules.
*
* @bodyParam schedules[0] string[] required The list of schedule Ids to delete. Example: 1234
* @bodyParam schedules[1] string[] required The list of schedule Ids to delete. Example: 5432
* @bodyParam schedules string[] required The list of schedule Ids to delete. Example: [1234, 5432]
*
* @param \Source\UseCases\Schedules\ScheduleDelete\ScheduleDeleteUseCase $scheduleDelete
* @return \Illuminate\Http\JsonResponse
......
......@@ -67,6 +67,8 @@ class UsersController extends ApiController
*
* This endpoint gets a specific user and returns information relating directly to the user.
*
* @urlParam userId required The id of the user to update. Example: 2
*
* @response 404 {"status":"error","code":404,"message":"Entity not found"}
*
* @param \Source\UseCases\Users\GetUser\GetUserUseCase $getUser
......@@ -227,10 +229,8 @@ class UsersController extends ApiController
*
* This route adds a user to a group
*
* @bodyParam user_ids[0] string[] required The list of user ids to attach. Example: 69
* @bodyParam user_ids[1] string[] required The list of user ids to attach. Example: 420
* @bodyParam group_ids[0] string[] required The list of group Ids to attach to. Example: 4
* @bodyParam group_ids[1] string[] required The list of group Ids to attach to. Example: 5
* @bodyParam user_ids string[] required The list of user ids to attach. Example: [69, 420]
* @bodyParam group_ids string[] required The list of group Ids to attach to. Example: [4, 5]
*
* @param \Source\UseCases\GroupUser\AddUserToGroup\AddUserToGroupUseCase $useCase
* @return \Illuminate\Http\JsonResponse
......@@ -263,10 +263,8 @@ class UsersController extends ApiController
*
* This route removes a user from a group.
*
* @bodyParam user_ids[0] string[] required The list of user ids to attach. Example: 69
* @bodyParam user_ids[1] string[] required The list of user ids to attach. Example: 420
* @bodyParam group_ids[0] string[] required The list of group Ids to attach to. Example: 4
* @bodyParam group_ids[1] string[] required The list of group Ids to attach to. Example: 5
* @bodyParam user_ids string[] required The list of user ids to attach. Example: [69, 420]
* @bodyParam group_ids string[] required The list of group Ids to attach to. Example: [4, 5]
*
* @param \Source\UseCases\GroupUser\RemoveUserFromGroup\RemoveUserFromGroupUseCase $useCase
* @return \Illuminate\Http\JsonResponse
......
......@@ -74,7 +74,7 @@ return [
* Where is the auth value meant to be sent in a request?
* Options: query, body, query_or_body, basic, bearer, header (for custom header)
*/
'in' => 'bearer',
'in' => 'query_or_body',
/*
* The name of the parameter (eg token, key, apiKey) or header (eg Authorization, Api-Key).
......@@ -526,7 +526,6 @@ INTRO
\App\Documentation\Strategies\BodyAuthenticationStrategy::class,
],
'responses' => [
\App\Documentation\Strategies\ApplicationRepositoryResetStrategy::class,
\Knuckles\Scribe\Extracting\Strategies\Responses\UseTransformerTags::class,
\Knuckles\Scribe\Extracting\Strategies\Responses\UseResponseTag::class,
\Knuckles\Scribe\Extracting\Strategies\Responses\UseResponseFileTag::class,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment