Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "contributte/apitte",
"description": "An opinionated and enjoyable API framework based on Nette Framework. Supporting content negotiation, debugging, middlewares, attributes, annotations and loving openapi/swagger.",
"description": "An opinionated and enjoyable API framework based on Nette Framework. Supporting content negotiation, debugging, middlewares, attributes and loving openapi/swagger.",
"keywords": [
"api",
"apitte",
"http",
"rest",
"nette",
"annotation"
"attribute"
],
"type": "library",
"license": "MIT",
Expand All @@ -25,9 +25,7 @@
"contributte/psr7-http-message": "^0.9.0 || ^0.10.0",
"contributte/middlewares": "^0.11.0 || ^0.12.0",
"contributte/openapi": "^0.1.0",
"doctrine/annotations": "^1.14.3 || ^2.0.0",
"koriym/attributes": "^1.0.5",
"nette/utils": "^4.0.0"
"nette/utils": "^4.1.0"
},
"require-dev": {
"contributte/qa": "^0.4",
Expand Down
4 changes: 0 additions & 4 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ parameters:
- message: "#^Parameter \\#2 \\$array of function implode expects array\\<string\\>, array\\<int, array\\<string\\>\\|string\\> given\\.$#"
path: %currentWorkingDirectory%/src/OpenApi/SchemaDefinition/Entity/EntityAdapter.php

# Support for doctrine/annotations ^1
- message: "#^Call to function method_exists\\(\\) with 'Doctrine\\\\\\\\Common\\\\\\\\Annotations\\\\\\\\AnnotationRegistry' and 'registerUniqueLoader' will always evaluate to false\\.$#"
path: src/Core/DI/LoaderFactory/DualReaderFactory.php

- message: "#^Dead catch - TypeError is never thrown in the try block.$#"
path: src/Core/Mapping/Parameter/DateTimeTypeMapper.php
count: 1
11 changes: 2 additions & 9 deletions src/Core/Annotation/Controller/Id.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,8 @@
namespace Apitte\Core\Annotation\Controller;

use Attribute;
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
use Doctrine\Common\Annotations\Annotation\Target;
use Doctrine\Common\Annotations\AnnotationException;
use InvalidArgumentException;

/**
* @Annotation
* @Target({"CLASS","METHOD"})
* @NamedArgumentConstructor()
*/
#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD)]
class Id
{
Expand All @@ -21,7 +14,7 @@ public function __construct(
)
{
if ($name === '') {
throw new AnnotationException('Empty @Id given');
throw new InvalidArgumentException('Empty #[Id] given');
}
}

Expand Down
13 changes: 3 additions & 10 deletions src/Core/Annotation/Controller/Method.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,8 @@
namespace Apitte\Core\Annotation\Controller;

use Attribute;
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
use Doctrine\Common\Annotations\Annotation\Target;
use Doctrine\Common\Annotations\AnnotationException;

/**
* @Annotation
* @Target("METHOD")
* @NamedArgumentConstructor()
*/
use InvalidArgumentException;

#[Attribute(Attribute::TARGET_METHOD)]
class Method
{
Expand All @@ -25,7 +18,7 @@ class Method
public function __construct(array|string $methods)
{
if (empty($methods)) {
throw new AnnotationException('Empty @Method given');
throw new InvalidArgumentException('Empty #[Method] given');
}

// Wrap single given method into array
Expand Down
9 changes: 1 addition & 8 deletions src/Core/Annotation/Controller/Negotiation.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,7 @@
namespace Apitte\Core\Annotation\Controller;

use Attribute;
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
use Doctrine\Common\Annotations\Annotation\Target;

/**
* @Annotation
* @Target("ANNOTATION")
* @NamedArgumentConstructor()
*/

#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
class Negotiation
{
Expand Down
45 changes: 0 additions & 45 deletions src/Core/Annotation/Controller/Negotiations.php

This file was deleted.

9 changes: 1 addition & 8 deletions src/Core/Annotation/Controller/OpenApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,7 @@
namespace Apitte\Core\Annotation\Controller;

use Attribute;
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
use Doctrine\Common\Annotations\Annotation\Target;

/**
* @Annotation
* @Target({"CLASS","METHOD"})
* @NamedArgumentConstructor()
*/

#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD)]
class OpenApi
{
Expand Down
11 changes: 2 additions & 9 deletions src/Core/Annotation/Controller/Path.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,8 @@
namespace Apitte\Core\Annotation\Controller;

use Attribute;
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
use Doctrine\Common\Annotations\Annotation\Target;
use Doctrine\Common\Annotations\AnnotationException;
use InvalidArgumentException;

/**
* @Annotation
* @Target({"CLASS","METHOD"})
* @NamedArgumentConstructor()
*/
#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD)]
class Path
{
Expand All @@ -21,7 +14,7 @@ public function __construct(
)
{
if ($path === '') {
throw new AnnotationException('Empty @Path given');
throw new InvalidArgumentException('Empty #[Path] given');
}
}

Expand Down
9 changes: 1 addition & 8 deletions src/Core/Annotation/Controller/RequestBody.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,7 @@
namespace Apitte\Core\Annotation\Controller;

use Attribute;
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
use Doctrine\Common\Annotations\Annotation\Target;

/**
* @Annotation
* @Target("METHOD")
* @NamedArgumentConstructor()
*/

#[Attribute(Attribute::TARGET_METHOD)]
class RequestBody
{
Expand Down
15 changes: 4 additions & 11 deletions src/Core/Annotation/Controller/RequestParameter.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,8 @@

use Apitte\Core\Schema\EndpointParameter;
use Attribute;
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
use Doctrine\Common\Annotations\Annotation\Target;
use Doctrine\Common\Annotations\AnnotationException;
use InvalidArgumentException;

/**
* @Annotation
* @Target("ANNOTATION")
* @NamedArgumentConstructor()
*/
#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
class RequestParameter
{
Expand All @@ -32,15 +25,15 @@ public function __construct(
)
{
if ($name === '') {
throw new AnnotationException('Empty @RequestParameter name given');
throw new InvalidArgumentException('Empty #[RequestParameter] name given');
}

if ($type === '') {
throw new AnnotationException('Empty @RequestParameter type given');
throw new InvalidArgumentException('Empty #[RequestParameter] type given');
}

if (!in_array($in, EndpointParameter::IN, true)) {
throw new AnnotationException('Invalid @RequestParameter in given');
throw new InvalidArgumentException('Invalid #[RequestParameter] in given');
}
}

Expand Down
67 changes: 0 additions & 67 deletions src/Core/Annotation/Controller/RequestParameters.php

This file was deleted.

13 changes: 3 additions & 10 deletions src/Core/Annotation/Controller/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,8 @@
namespace Apitte\Core\Annotation\Controller;

use Attribute;
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
use Doctrine\Common\Annotations\Annotation\Target;
use Doctrine\Common\Annotations\AnnotationException;

/**
* @Annotation
* @Target("ANNOTATION")
* @NamedArgumentConstructor()
*/
use InvalidArgumentException;

#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
class Response
{
Expand All @@ -23,7 +16,7 @@ public function __construct(
)
{
if (empty($description)) {
throw new AnnotationException('Empty @Response description given');
throw new InvalidArgumentException('Empty #[Response] description given');
}
}

Expand Down
Loading