Open eelco2k opened 3 weeks ago
Allow handlers to conform to DTO. (these also need to be created/generated...)
$query = static::getEloquentQuery(); $model = static::getModel(); $query = QueryBuilder::for($query) ->allowedFields($model::$allowedFields ?? []) ->allowedSorts($model::$allowedSorts ?? []) ->allowedFilters($model::$allowedFilters ?? []) ->allowedIncludes($model::$allowedIncludes ?? null) ->paginate(request()->query('per_page')) ->appends(request()->query()) ;
instead of:
return static::getApiTransformer()::collection($query)
use this:
return static::getApiTransformer()::collection(BlogData::collect($query));
where BlogData is a spatie laravel-data DTO.
The benefit would be that because the DTO knows column types etc. this information can be used to generate correct API Swagger docs for Schemas, Parameters etc.. see:
https://github.com/xolvionl/laravel-data-openapi-generator/tree/main/src/Data
nice to have
latest
8.3
11
No response
i think this is good to have, we can use the DTO for request validation too.
What happened?
Allow handlers to conform to DTO. (these also need to be created/generated...)
instead of:
use this:
where BlogData is a spatie laravel-data DTO.
The benefit would be that because the DTO knows column types etc. this information can be used to generate correct API Swagger docs for Schemas, Parameters etc.. see:
https://github.com/xolvionl/laravel-data-openapi-generator/tree/main/src/Data
How to reproduce the bug
nice to have
Package Version
latest
PHP Version
8.3
Laravel Version
11
Which operating systems does with happen with?
No response
Notes
No response