Skip to content

Commit

Permalink
chevere 4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rodber committed Dec 6, 2023
1 parent 78362b7 commit b244aa4
Show file tree
Hide file tree
Showing 27 changed files with 75 additions and 68 deletions.
2 changes: 1 addition & 1 deletion .vscode/controller.code-snippets
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"",
"namespace Chevere\\Demo\\Controllers;",
"",
"use Chevere\\Attributes\\Description;",
"use Chevere\\Http\\Attributes\\Description;",
"use Chevere\\Http\\Attributes\\Response;"
"use Chevere\\Http\\Controller;",
"use Chevere\\Http\\Header;",
Expand Down
4 changes: 2 additions & 2 deletions .vscode/templates.code-snippets
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"",
"namespace Chevere\\SchwagerHTML;",
"",
"use Chevere\\Exceptions\\Core\\Exception;",
"use Exception;",
"",
"/**",
" * Exception thrown when ${1:description}.",
Expand Down Expand Up @@ -101,7 +101,7 @@
"",
"namespace Chevere\\SchwagerHTML\\\\${TM_DIRECTORY/.*src\\/(([^\\/]*)(\\/)?)|(\\/)([^\\/]*)/$2${3:+.}${5:+.}$5/g};",
"",
"use Chevere\\Exceptions\\Core\\Exception;",
"use Exception;",
"",
"/**",
" * Exception thrown when ${1:description}.",
Expand Down
7 changes: 5 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@
}
],
"require": {
"chevere/chevere": "^4.0.x-dev",
"php": "^8.1",
"chevere/action": "^1.0.x-dev",
"chevere/http": "^0.4.x-dev",
"chevere/parameter": "^1.0.x-dev",
"chevere/router": "^0.6.x-dev",
"chevere/schwager": "^0.2.x-dev",
"symfony/yaml": "^6.3"
"chevere/standard": "^1.0.x-dev",
"symfony/yaml": "^7.0"
},
"require-dev": {
"chevere/var-dump": "^0.10.x-dev",
Expand Down
5 changes: 3 additions & 2 deletions demo/Controllers/PetDeleteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@

namespace Chevere\Demo\Controllers;

use Chevere\Attributes\Description;
use Chevere\Http\Attributes\Description;
use Chevere\Http\Attributes\Response;
use Chevere\Http\Controller;
use Chevere\Http\Header;
use Chevere\Http\Status;
use Chevere\Parameter\Attributes\StringAttr;
use Chevere\Parameter\Interfaces\ArrayParameterInterface;
use Chevere\Parameter\Interfaces\ParameterInterface;
use function Chevere\Parameter\arrayp;
Expand All @@ -44,7 +45,7 @@ public static function acceptResponse(): ParameterInterface
}

public function run(
#[Description('Pet id to delete')]
#[StringAttr(description: 'Pet id to delete')]
string $petId
): void {
}
Expand Down
5 changes: 3 additions & 2 deletions demo/Controllers/PetGetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@

namespace Chevere\Demo\Controllers;

use Chevere\Attributes\Description;
use Chevere\Http\Attributes\Description;
use Chevere\Http\Attributes\Response;
use Chevere\Http\Controller;
use Chevere\Http\Header;
use Chevere\Http\Status;
use Chevere\Parameter\Attributes\StringAttr;
use Chevere\Parameter\Interfaces\ArrayStringParameterInterface;
use Chevere\Parameter\Interfaces\ParameterInterface;
use function Chevere\Parameter\arrayp;
Expand Down Expand Up @@ -69,7 +70,7 @@ public static function acceptResponse(): ParameterInterface
}

public function run(
#[Description('ID of pet to return')]
#[StringAttr(description: 'ID of pet to return')]
string $petId
): array {
return [];
Expand Down
5 changes: 3 additions & 2 deletions demo/Controllers/PetPostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@

namespace Chevere\Demo\Controllers;

use Chevere\Attributes\Description;
use Chevere\Http\Attributes\Description;
use Chevere\Http\Attributes\Response;
use Chevere\Http\Controller;
use Chevere\Http\Header;
use Chevere\Http\Status;
use Chevere\Parameter\Attributes\StringAttr;
use Chevere\Parameter\Interfaces\ArrayParameterInterface;
use Chevere\Parameter\Interfaces\ParameterInterface;
use function Chevere\Parameter\arrayp;
Expand Down Expand Up @@ -48,7 +49,7 @@ public static function acceptResponse(): ParameterInterface
}

public function run(
#[Description('ID of pet that needs to be updated')]
#[StringAttr(description: 'ID of pet that needs to be updated')]
string $petId
): void {
}
Expand Down
2 changes: 1 addition & 1 deletion demo/Controllers/PetPutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace Chevere\Demo\Controllers;

use Chevere\Attributes\Description;
use Chevere\Http\Attributes\Description;
use Chevere\Http\Attributes\Response;
use Chevere\Http\Controller;
use Chevere\Http\Header;
Expand Down
2 changes: 1 addition & 1 deletion demo/Controllers/PetsFindByStatusGetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace Chevere\Demo\Controllers;

use Chevere\Attributes\Description;
use Chevere\Http\Attributes\Description;
use Chevere\Http\Attributes\Response;
use Chevere\Http\Controller;
use Chevere\Http\Header;
Expand Down
2 changes: 1 addition & 1 deletion demo/Controllers/PetsFindByTagGetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace Chevere\Demo\Controllers;

use Chevere\Attributes\Description;
use Chevere\Http\Attributes\Description;
use Chevere\Http\Attributes\Response;
use Chevere\Http\Controller;
use Chevere\Http\Header;
Expand Down
2 changes: 1 addition & 1 deletion demo/Controllers/PetsPostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace Chevere\Demo\Controllers;

use Chevere\Attributes\Description;
use Chevere\Http\Attributes\Description;
use Chevere\Http\Attributes\Response;
use Chevere\Http\Controller;
use Chevere\Http\Header;
Expand Down
2 changes: 1 addition & 1 deletion demo/Controllers/StoreInventoryGetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace Chevere\Demo\Controllers;

use Chevere\Attributes\Description;
use Chevere\Http\Attributes\Description;
use Chevere\Http\Attributes\Response;
use Chevere\Http\Controller;
use Chevere\Http\Header;
Expand Down
5 changes: 3 additions & 2 deletions demo/Controllers/StoreOrderDeleteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@

namespace Chevere\Demo\Controllers;

use Chevere\Attributes\Description;
use Chevere\Http\Attributes\Description;
use Chevere\Http\Attributes\Response;
use Chevere\Http\Controller;
use Chevere\Http\Header;
use Chevere\Http\Status;
use Chevere\Parameter\Attributes\StringAttr;
use Chevere\Parameter\Interfaces\ParameterInterface;
use function Chevere\Parameter\null;

Expand All @@ -34,7 +35,7 @@ public static function acceptResponse(): ParameterInterface
}

public function run(
#[Description('ID of the order that needs to be deleted')]
#[StringAttr(description: 'ID of the order that needs to be deleted')]
string $orderId
): void {
}
Expand Down
5 changes: 3 additions & 2 deletions demo/Controllers/StoreOrderGetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@

namespace Chevere\Demo\Controllers;

use Chevere\Attributes\Description;
use Chevere\Http\Attributes\Description;
use Chevere\Http\Attributes\Response;
use Chevere\Http\Controller;
use Chevere\Http\Header;
use Chevere\Http\Status;
use Chevere\Parameter\Attributes\StringAttr;
use Chevere\Parameter\Interfaces\ParameterInterface;
use function Chevere\Parameter\arrayp;
use function Chevere\Parameter\bool;
Expand Down Expand Up @@ -45,7 +46,7 @@ public static function acceptResponse(): ParameterInterface
}

public function run(
#[Description('ID of pet that needs to be fetched')]
#[StringAttr(description: 'ID of pet that needs to be fetched')]
string $orderId
): array {
return [];
Expand Down
2 changes: 1 addition & 1 deletion demo/Controllers/StoreOrderPostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace Chevere\Demo\Controllers;

use Chevere\Attributes\Description;
use Chevere\Http\Attributes\Description;
use Chevere\Http\Attributes\Response;
use Chevere\Http\Controller;
use Chevere\Http\Header;
Expand Down
5 changes: 3 additions & 2 deletions demo/Controllers/UploadImagePostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@

namespace Chevere\Demo\Controllers;

use Chevere\Attributes\Description;
use Chevere\Http\Attributes\Description;
use Chevere\Http\Attributes\Response;
use Chevere\Http\Controller;
use Chevere\Http\Header;
use Chevere\Http\Status;
use Chevere\Parameter\Attributes\StringAttr;
use Chevere\Parameter\Interfaces\ArrayParameterInterface;
use Chevere\Parameter\Interfaces\ParameterInterface;
use function Chevere\Parameter\arrayp;
Expand Down Expand Up @@ -49,7 +50,7 @@ public static function acceptResponse(): ParameterInterface
}

public function run(
#[Description('ID of pet to update')]
#[StringAttr(description: 'ID of pet to update')]
string $petId
): array {
return [];
Expand Down
2 changes: 1 addition & 1 deletion demo/Controllers/UserCreateWithArrayPostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace Chevere\Demo\Controllers;

use Chevere\Attributes\Description;
use Chevere\Http\Attributes\Description;
use Chevere\Http\Attributes\Response;
use Chevere\Http\Controller;
use Chevere\Http\Header;
Expand Down
2 changes: 1 addition & 1 deletion demo/Controllers/UserCreateWithListPostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace Chevere\Demo\Controllers;

use Chevere\Attributes\Description;
use Chevere\Http\Attributes\Description;
use Chevere\Http\Attributes\Response;
use Chevere\Http\Controller;
use Chevere\Http\Header;
Expand Down
5 changes: 3 additions & 2 deletions demo/Controllers/UserDeleteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@

namespace Chevere\Demo\Controllers;

use Chevere\Attributes\Description;
use Chevere\Http\Attributes\Description;
use Chevere\Http\Attributes\Response;
use Chevere\Http\Controller;
use Chevere\Http\Header;
use Chevere\Http\Status;
use Chevere\Parameter\Attributes\StringAttr;
use Chevere\Parameter\Interfaces\ParameterInterface;
use function Chevere\Parameter\null;

Expand All @@ -34,7 +35,7 @@ public static function acceptResponse(): ParameterInterface
}

public function run(
#[Description('The name that needs to be deleted')]
#[StringAttr(description: 'The name that needs to be deleted')]
string $username
): void {
}
Expand Down
5 changes: 3 additions & 2 deletions demo/Controllers/UserGetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@

namespace Chevere\Demo\Controllers;

use Chevere\Attributes\Description;
use Chevere\Http\Attributes\Description;
use Chevere\Http\Attributes\Response;
use Chevere\Http\Controller;
use Chevere\Http\Header;
use Chevere\Http\Status;
use Chevere\Parameter\Attributes\StringAttr;
use Chevere\Parameter\Interfaces\ParameterInterface;
use function Chevere\Parameter\arrayp;
use function Chevere\Parameter\int;
Expand Down Expand Up @@ -45,7 +46,7 @@ public static function acceptResponse(): ParameterInterface
}

public function run(
#[Description('The name that needs to be fetched')]
#[StringAttr(description: 'The name that needs to be fetched')]
string $username
): array {
return [];
Expand Down
2 changes: 1 addition & 1 deletion demo/Controllers/UserLoginGetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace Chevere\Demo\Controllers;

use Chevere\Attributes\Description;
use Chevere\Http\Attributes\Description;
use Chevere\Http\Attributes\Response;
use Chevere\Http\Controller;
use Chevere\Http\Header;
Expand Down
2 changes: 1 addition & 1 deletion demo/Controllers/UserLogoutGetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace Chevere\Demo\Controllers;

use Chevere\Attributes\Description;
use Chevere\Http\Attributes\Description;
use Chevere\Http\Attributes\Response;
use Chevere\Http\Controller;
use Chevere\Http\Status;
Expand Down
5 changes: 3 additions & 2 deletions demo/Controllers/UserPutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@

namespace Chevere\Demo\Controllers;

use Chevere\Attributes\Description;
use Chevere\Http\Attributes\Description;
use Chevere\Http\Attributes\Response;
use Chevere\Http\Controller;
use Chevere\Http\Header;
use Chevere\Http\Status;
use Chevere\Parameter\Attributes\StringAttr;
use Chevere\Parameter\Interfaces\ParameterInterface;
use function Chevere\Parameter\null;

Expand All @@ -34,7 +35,7 @@ public static function acceptResponse(): ParameterInterface
}

public function run(
#[Description('name that need to be updated')]
#[StringAttr(description: 'name that need to be updated')]
string $username
): void {
}
Expand Down
2 changes: 1 addition & 1 deletion demo/Controllers/UsersPostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace Chevere\Demo\Controllers;

use Chevere\Attributes\Description;
use Chevere\Http\Attributes\Description;
use Chevere\Http\Attributes\Response;
use Chevere\Http\Controller;
use Chevere\Http\Status;
Expand Down
11 changes: 4 additions & 7 deletions demo/demo.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use Chevere\Schwager\ServerSchema;
use Chevere\Schwager\Spec;
use Chevere\SchwagerHTML\Html;
use function Chevere\Filesystem\fileForPath;
use function Chevere\Router\router;

foreach (['/../', '/../../../../'] as $path) {
Expand Down Expand Up @@ -44,12 +43,10 @@
);
$spec = new Spec($router, $document, $demoServer, $otherServer);
$html = new Html($spec);
$file = fileForPath(__DIR__ . '/output/schwager.html');
$file->createIfNotExists();
$file->put($html->__toString());
$result = $file->path()->__toString();
$file = __DIR__ . '/output/schwager.html';
file_put_contents($file, $html->__toString());
echo <<<PLAIN
[OK] {$result}
[OK] {$file}
PLAIN;
passthru("open {$result}");
passthru("open {$file}");
Loading

0 comments on commit b244aa4

Please sign in to comment.