Skip to content

Commit 00ef984

Browse files
committed
wip: use new validation implementation
1 parent b20c3ad commit 00ef984

File tree

13 files changed

+33
-212
lines changed

13 files changed

+33
-212
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"php": "^8.2",
2727
"ext-json": "*",
2828
"laravel-json-api/core": "^5.0",
29-
"laravel-json-api/eloquent": "^5.0",
29+
"laravel-json-api/eloquent": "dev-feature/validation",
3030
"laravel-json-api/encoder-neomerx": "^5.0",
3131
"laravel-json-api/exceptions": "^4.0",
3232
"laravel-json-api/spec": "^4.0",

src/Routing/ResourceRegistrar.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,9 @@ protected function addResourceDestroy(string $resourceType, string $controller,
309309
private function getResourceUri(string $resourceType): string
310310
{
311311
return $this->server
312-
->schemas()
313-
->schemaFor($resourceType)
314-
->uriType();
312+
->statics()
313+
->schemaForType($resourceType)
314+
->getUriType();
315315
}
316316

317317
/**

src/ServiceProvider.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,6 @@ public function register(): void
7474

7575
/** @TODO wtf? why isn't it working without this? */
7676
$this->app->bind(Pipeline::class, \Illuminate\Pipeline\Pipeline::class);
77-
78-
/** @TODO will need to remove this temporary wiring */
79-
$this->app->bind(Contracts\Validation\Container::class, Validation\Container::class);
8077
}
8178

8279
/**

src/Validation/Container.php

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/Validation/Factory.php

Lines changed: 0 additions & 125 deletions
This file was deleted.

tests/dummy/app/JsonApi/V1/Comments/CommentSchema.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace App\JsonApi\V1\Comments;
1313

1414
use App\Models\Comment;
15+
use LaravelJsonApi\Core\Schema\Attributes\Model;
1516
use LaravelJsonApi\Eloquent\Fields\DateTime;
1617
use LaravelJsonApi\Eloquent\Fields\ID;
1718
use LaravelJsonApi\Eloquent\Fields\Relations\BelongsTo;
@@ -20,16 +21,9 @@
2021
use LaravelJsonApi\Eloquent\Pagination\PagePagination;
2122
use LaravelJsonApi\Eloquent\Schema;
2223

24+
#[Model(Comment::class)]
2325
class CommentSchema extends Schema
2426
{
25-
26-
/**
27-
* The model the schema corresponds to.
28-
*
29-
* @var string
30-
*/
31-
public static string $model = Comment::class;
32-
3327
/**
3428
* @inheritDoc
3529
*/

tests/dummy/app/JsonApi/V1/Images/ImageSchema.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,17 @@
1212
namespace App\JsonApi\V1\Images;
1313

1414
use App\Models\Image;
15+
use LaravelJsonApi\Core\Schema\Attributes\Model;
1516
use LaravelJsonApi\Eloquent\Fields\DateTime;
1617
use LaravelJsonApi\Eloquent\Fields\ID;
1718
use LaravelJsonApi\Eloquent\Fields\Str;
1819
use LaravelJsonApi\Eloquent\Filters\WhereIdIn;
1920
use LaravelJsonApi\Eloquent\Pagination\PagePagination;
2021
use LaravelJsonApi\Eloquent\Schema;
2122

23+
#[Model(Image::class)]
2224
class ImageSchema extends Schema
2325
{
24-
25-
/**
26-
* The model the schema corresponds to.
27-
*
28-
* @var string
29-
*/
30-
public static string $model = Image::class;
31-
3226
/**
3327
* @inheritDoc
3428
*/

tests/dummy/app/JsonApi/V1/Phones/PhoneSchema.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@
1212
namespace App\JsonApi\V1\Phones;
1313

1414
use App\Models\Phone;
15+
use LaravelJsonApi\Core\Schema\Attributes\Model;
1516
use LaravelJsonApi\Eloquent\Fields\DateTime;
1617
use LaravelJsonApi\Eloquent\Fields\ID;
1718
use LaravelJsonApi\Eloquent\Fields\Str;
1819
use LaravelJsonApi\Eloquent\Schema;
1920

21+
#[Model(Phone::class)]
2022
class PhoneSchema extends Schema
2123
{
2224
/**

tests/dummy/app/JsonApi/V1/Posts/PostSchema.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace App\JsonApi\V1\Posts;
1313

1414
use App\Models\Post;
15+
use LaravelJsonApi\Core\Schema\Attributes\Model;
1516
use LaravelJsonApi\Eloquent\Fields\DateTime;
1617
use LaravelJsonApi\Eloquent\Fields\ID;
1718
use LaravelJsonApi\Eloquent\Fields\Relations\BelongsTo;
@@ -30,17 +31,11 @@
3031
use LaravelJsonApi\Eloquent\SoftDeletes;
3132
use LaravelJsonApi\Eloquent\Sorting\SortCountable;
3233

34+
#[Model(Post::class)]
3335
class PostSchema extends Schema
3436
{
3537
use SoftDeletes;
3638

37-
/**
38-
* The model the schema corresponds to.
39-
*
40-
* @var string
41-
*/
42-
public static string $model = Post::class;
43-
4439
/**
4540
* The maximum depth of include paths.
4641
*

tests/dummy/app/JsonApi/V1/Tags/TagSchema.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace App\JsonApi\V1\Tags;
1313

1414
use App\Models\Tag;
15+
use LaravelJsonApi\Core\Schema\Attributes\Model;
1516
use LaravelJsonApi\Eloquent\Fields\DateTime;
1617
use LaravelJsonApi\Eloquent\Fields\ID;
1718
use LaravelJsonApi\Eloquent\Fields\Relations\BelongsToMany;
@@ -20,16 +21,9 @@
2021
use LaravelJsonApi\Eloquent\Pagination\PagePagination;
2122
use LaravelJsonApi\Eloquent\Schema;
2223

24+
#[Model(Tag::class)]
2325
class TagSchema extends Schema
2426
{
25-
26-
/**
27-
* The model the schema corresponds to.
28-
*
29-
* @var string
30-
*/
31-
public static string $model = Tag::class;
32-
3327
/**
3428
* @inheritDoc
3529
*/

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy