Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
d8vjork committed Jan 17, 2024
1 parent 604b94d commit 95168f0
Show file tree
Hide file tree
Showing 38 changed files with 790 additions and 593 deletions.
5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"php-cs-fixer.executablePath": "${workspaceFolder}/vendor/bin/php-cs-fixer"
}
"php-cs-fixer.executablePath": "${workspaceFolder}/vendor/bin/php-cs-fixer",
"php.version": "8.3.1"
}
17 changes: 17 additions & 0 deletions config/apiable.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,21 @@
'include_ids_on_attributes' => false,
],

/**
* Default options for responses like: normalize relations names, include allowed filters and sorts, etc.
*
* @see https://docs.opensoutheners.com/laravel-apiable/guide/documentation.html
*/
'documentation' => [

'markdown' => [
'base_path' => 'storage/exports/markdown',
],

'postman' => [
'base_path' => 'storage/exports',
],

],

];
10 changes: 10 additions & 0 deletions src/Attributes/AppendsQueryParam.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace OpenSoutheners\LaravelApiable\Attributes;

use Attribute;
use OpenSoutheners\LaravelApiable\Support\Facades\Apiable;

#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
final class AppendsQueryParam extends QueryParam
Expand All @@ -11,4 +12,13 @@ public function __construct(public string $type, public array $attributes, publi
{
//
}

public function getTypeAsResource(): string
{
if (! str_contains($this->type, '\\')) {
return $this->type;
}

return Apiable::getResourceType($this->type);
}
}
14 changes: 0 additions & 14 deletions src/Attributes/DocumentedEndpointSection.php

This file was deleted.

10 changes: 10 additions & 0 deletions src/Attributes/FieldsQueryParam.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace OpenSoutheners\LaravelApiable\Attributes;

use Attribute;
use OpenSoutheners\LaravelApiable\Support\Facades\Apiable;

#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
final class FieldsQueryParam extends QueryParam
Expand All @@ -11,4 +12,13 @@ public function __construct(public string $type, public array $fields, public st
{
//
}

public function getTypeAsResource(): string
{
if (! str_contains($this->type, '\\')) {
return $this->type;
}

return Apiable::getResourceType($this->type);
}
}
2 changes: 2 additions & 0 deletions src/Attributes/FilterQueryParam.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
namespace OpenSoutheners\LaravelApiable\Attributes;

use Attribute;
use Illuminate\Support\Carbon;
use Illuminate\Support\Str;
use OpenSoutheners\LaravelApiable\Http\QueryParamValueType;

#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
Expand Down
14 changes: 14 additions & 0 deletions src/Attributes/ResourceResponse.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace OpenSoutheners\LaravelApiable\Attributes;

class ResourceResponse
{
/**
* @param class-string<\Illuminate\Database\Eloquent\Model> $resource
*/
public function __construct(public string $resource)
{
//
}
}
Empty file added src/Config.php
Empty file.
Loading

0 comments on commit 95168f0

Please sign in to comment.