Comments (5)
I was thinking of putting it in a /Virtual/ folder with some empty classes, that way it is separted from actual code. This also means that you can regenerate API docs of one or more resources based on those api docs stubs again and again.
You are absolutely correct that the BRANDS
is not okay. it was just an example and can be dynamically fetched from classname of resource.
And yes, an extra static function on the handler class isTenantAwerenessEnabled() is a good idea.
I just posted a rough WiP.. but i will add your considerations :)
from filament-api-service.
yeah its a good idea, but i think this must be optional. The documentation will generated if developer parse argument, like --swagger
maybe. so the artisan command look like php artisan make:filament-api-service BlogResource --swagger
.
and i don't like this part define('TENANT_AWARENESS_BRANDS', true);
. The BRANDS
is make confused. if you want to do this,
we can use resource property on every handler. maybe adding this method to Handlers class :
public static function isTenantAwarenessEnabled() : bool
{
return static::getResource()::isScopedToTenant();
}
so you can call it while registering the routes.
from filament-api-service.
first work on swagger generation. I created it as a separate command instead of --swagger option in the filament-api-service for now.
rough work is in this feature branch as pull request #51
from filament-api-service.
thank you for the tools. eelco2k fix it critical errors
$baseResourceSourcePath = (string) str($resourceClass)->prepend('/')->prepend(base_path($resourcePath))
->replace('\\', '/')->replace('//', '/')
->replace('App', 'app'); // default
and
<?php
namespace {{ namespace }}\{{ resourceClass }}\Transformers;
use OpenApi\Attributes as OAT;
#[OAT\Schema(
schema: "{{ transformerName }}",
title: "{{ transformerName }}",
description: "{{ modelClass }} API Transformer",
xml: new OAT\Xml(name: "{{ transformerName }}"),
)]
->replace('App', 'app')
Xml
It would be nice to add an example of use
php artisan make:filament-resource User
php artisan make:filament-api-service UserResource
php artisan make:filament-api-transformer UserResource
add in UserResource
/**
* @return string|null
*/
public static function getApiTransformer(): ?string
{
return UserTransformer::class;
}
php artisan make:filament-api-docs UserResource
php artisan l5-swagger:generate
I used the package until the patch was accepted
composer require cweagans/composer-patches
and composer,json
"extra": {
"laravel": {
"dont-discover": []
},
"patches": {
"rupadana/filament-api-service": {
"add command filament-api-docs (for generate swagger)": "patches/rupadana/filament-api-service/filament-api-docs.txt"
}
},
"enable-patching": true
},
"config": {
"optimize-autoloader": true,
"preferred-install": "source",
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true,
"php-http/discovery": true,
"cweagans/composer-patches": true
}
},
Thanks for the work. Good luck in your development!
from filament-api-service.
@POMXARK I've added your patches. hopefully everything works now.
from filament-api-service.
Related Issues (20)
- Add an example to use laravel sanctum
- Create a Filament Page that can generate a sanctum token
- [Bug]: Route [login] not defined when access to an entity route HOT 9
- [Bug]: Incorrect api operation when working with multi-tenant HOT 5
- [Question]: Hide token resource HOT 4
- Allow non-admin users to generate API key to access their records HOT 7
- [Bug]: How publish config pckg? HOT 1
- [Feature]: add allowedIncludes() in PaginationHandler stub HOT 2
- [Enhancement]: Allow * in ability selection / scope HOT 1
- [Bug]: Laravel 11 Support? HOT 2
- [Bug]: in some cases groupStack for api routes are not correct (fix available) HOT 1
- [Feature]: Spatie Laravel-Query-Builder follow DTO via Spatie Laravel-data HOT 2
- [Feature]: Allow multiple transformers and select transformer via X-HEADERS HOT 8
- [Bug]: Not able to get the records from api HOT 5
- [Bug]: Call to undefined method App\Models\User::createToken() HOT 2
- [Enhancement]: use $tenantModel->getRouteKeyName() instead of $tenantModel->getKeyName()
- [Question]: How do I create API for related/child resources HOT 1
- [Bug]: Tokens routes do not work in prod environment HOT 1
- [Feature]: Allow versioned API
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from filament-api-service.