- WIP on reworking lean-api's visual
This commit is contained in:
parent
d2202066ba
commit
cb27ab7974
Binary file not shown.
After Width: | Height: | Size: 5.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 26 KiB |
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"name": "API",
|
||||
"short_name": "API",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/static/favicon/web-app-manifest-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable"
|
||||
},
|
||||
{
|
||||
"src": "/static/favicon/web-app-manifest-512x512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable"
|
||||
}
|
||||
],
|
||||
"theme_color": "#ffffff",
|
||||
"background_color": "#ffffff",
|
||||
"display": "standalone"
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 6.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
|
@ -38,8 +38,10 @@
|
|||
"lean" : {
|
||||
"autoload": {
|
||||
"definitions" : [
|
||||
"meta/definitions/software.php"
|
||||
],
|
||||
"config": [
|
||||
"meta/config.php"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'lean' => [
|
||||
'autoload' => [
|
||||
'lean.api',
|
||||
]
|
||||
],
|
||||
];
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
$path = dirname(__DIR__, 2);
|
||||
|
||||
return [
|
||||
'lean.api' => [
|
||||
'picea' => [
|
||||
'context' => Lean\Api\View::class,
|
||||
|
||||
'view' => [
|
||||
[
|
||||
'path' => implode(DIRECTORY_SEPARATOR, [ $path , "view", '' ]),
|
||||
'order' => 99,
|
||||
],
|
||||
],
|
||||
|
||||
'asset' => [
|
||||
[
|
||||
'path' => implode(DIRECTORY_SEPARATOR, [ $path, "asset", '' ]),
|
||||
'order' => 10
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
'tell' => [
|
||||
'json' => [
|
||||
[
|
||||
'path' => implode(DIRECTORY_SEPARATOR, [ $path, "meta", "i18n", "" ]),
|
||||
'order' => 99,
|
||||
],
|
||||
]
|
||||
],
|
||||
|
||||
'routes' => [
|
||||
'Lean\\Api\\Controller' => implode(DIRECTORY_SEPARATOR, [ $path, "src", "Controller", "" ]),
|
||||
],
|
||||
],
|
||||
];
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace Lean\Api\Attribute;
|
||||
|
||||
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_CLASS)]
|
||||
class EntityField
|
||||
{
|
||||
public function __construct(
|
||||
public string $description = "",
|
||||
public bool $mandatory = false,
|
||||
public ?int $minLength = null,
|
||||
public ?int $maxLength = null,
|
||||
public ?string $regexFormat = null,
|
||||
public mixed $example = null,
|
||||
) {}
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Lean\Api;
|
||||
|
||||
use Lean\Api\Attribute\EntityField;
|
||||
use Lean\Factory\HttpFactory;
|
||||
use Notes\ObjectReflection;
|
||||
use Notes\Route\Attribute\Method\Route;
|
||||
|
@ -80,6 +81,7 @@ class EntityDescriptor
|
|||
$table = $reflector->reflectClass()->getAttribute(Table::class);
|
||||
|
||||
foreach($reflector->reflectProperties() as $property) {
|
||||
$entityField = $property->getAttribute(EntityField::class);
|
||||
$field = $property->getAttribute(Field::class);
|
||||
|
||||
if ($field) {
|
||||
|
@ -87,7 +89,7 @@ class EntityDescriptor
|
|||
$propertyHtml .= sprintf(
|
||||
$this->entityField,
|
||||
$property->name,
|
||||
$field->object->description,
|
||||
$entityField->object->description ?? "",
|
||||
$field->object->name ?: $property->name,
|
||||
$field->tag,
|
||||
$field->object->type ?? implode(' | ', array_map(fn($e) => $e->type, $types)),
|
||||
|
|
Loading…
Reference in New Issue