Skip to content

Commit

Permalink
fix(tests): Missing import + serializer was not enabled when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
xavierleune committed Jan 16, 2025
1 parent 13408ab commit 13559b1
Show file tree
Hide file tree
Showing 9 changed files with 110 additions and 70 deletions.
19 changes: 19 additions & 0 deletions tests/Functional/Configs/EnableSerializer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
framework:
property_info:
enabled: true
serializer:
enabled: true
enable_attributes: true
validation:
enabled: true
enable_attributes: true
static_method:
- loadValidatorMetadata
translation_domain: validators
email_validation_mode: html5
mapping:
paths: { }
not_compromised_password:
enabled: true
endpoint: null
auto_mapping: { }
1 change: 1 addition & 0 deletions tests/Functional/Controller/MapQueryStringController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use Nelmio\ApiDocBundle\Tests\Functional\Entity\QueryModel\SortQueryModel;
use Nelmio\ApiDocBundle\Tests\Functional\Entity\SymfonyConstraintsWithValidationGroups;
use Nelmio\ApiDocBundle\Tests\Functional\Entity\SymfonyMapQueryString;
use OpenApi\Attributes as OA;
use Symfony\Component\HttpKernel\Attribute\MapQueryString;
use Symfony\Component\Routing\Annotation\Route;

Expand Down
1 change: 1 addition & 0 deletions tests/Functional/Controller/MapRequestPayloadArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace Nelmio\ApiDocBundle\Tests\Functional\Controller;

use Nelmio\ApiDocBundle\Tests\Functional\Entity\Article81;
use OpenApi\Attributes as OA;
use Symfony\Component\HttpKernel\Attribute\MapRequestPayload;
use Symfony\Component\Routing\Annotation\Route;

Expand Down
2 changes: 2 additions & 0 deletions tests/Functional/Controller/MapRequestPayloadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@

use Nelmio\ApiDocBundle\Annotation\Model;
use Nelmio\ApiDocBundle\Tests\Functional\Entity\Article81;
use Nelmio\ApiDocBundle\Tests\Functional\Entity\EntityWithNullableSchemaSet;
use Nelmio\ApiDocBundle\Tests\Functional\Entity\SymfonyConstraintsWithValidationGroups;
use OpenApi\Attributes as OA;
use Symfony\Component\HttpKernel\Attribute\MapRequestPayload;
use Symfony\Component\Routing\Annotation\Route;

Expand Down
8 changes: 7 additions & 1 deletion tests/Functional/ControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ public static function provideAttributeTestCases(): \Generator
[
'name' => 'MapQueryStringController',
'type' => $type,
null,
[],
[__DIR__ . '/Configs/EnableSerializer.yaml']
],
];
yield 'https://github.com/nelmio/NelmioApiDocBundle/issues/2191' => [
Expand All @@ -132,7 +135,7 @@ public static function provideAttributeTestCases(): \Generator
],
'MapQueryStringCleanupComponents',
[],
[__DIR__.'/Configs/CleanUnusedComponentsProcessor.yaml'],
[__DIR__.'/Configs/CleanUnusedComponentsProcessor.yaml', __DIR__ . '/Configs/EnableSerializer.yaml'],
];

yield 'operationId must always be generated' => [
Expand All @@ -154,6 +157,9 @@ public static function provideAttributeTestCases(): \Generator
'name' => 'MapRequestPayloadController',
'type' => $type,
],
null,
[],
[__DIR__ . '/Configs/EnableSerializer.yaml']
];

yield 'Create top level Tag from Tag attribute' => [
Expand Down
55 changes: 20 additions & 35 deletions tests/Functional/Fixtures/MapQueryStringCleanupComponents.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
}
],
"responses": {
"default": {
"200": {
"description": ""
}
}
Expand Down Expand Up @@ -115,7 +115,7 @@
}
],
"responses": {
"default": {
"200": {
"description": ""
}
}
Expand All @@ -135,27 +135,6 @@
"minimum": 1
}
},
{
"name": "propertyInDefaultGroup",
"in": "query",
"required": true,
"schema": {
"type": "integer",
"maximum": 100,
"minimum": 1
}
},
{
"name": "propertyArray[]",
"in": "query",
"required": true,
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
},
{
"name": "propertyNotNullOnSpecificGroup",
"in": "query",
Expand All @@ -166,7 +145,7 @@
}
],
"responses": {
"default": {
"200": {
"description": ""
}
}
Expand All @@ -179,14 +158,17 @@
{
"name": "id",
"in": "query",
"description": "Query parameter id description",
"required": true,
"schema": {
"type": "integer"
"type": "string",
"nullable": true
}
},
{
"name": "name",
"in": "query",
"description": "Query parameter name description",
"required": true,
"schema": {
"type": "string"
Expand All @@ -195,6 +177,7 @@
{
"name": "nullableName",
"in": "query",
"description": "Query parameter nullableName description",
"required": false,
"schema": {
"type": "string",
Expand All @@ -204,6 +187,7 @@
{
"name": "articleType81",
"in": "query",
"description": "Query parameter articleType81 description",
"required": true,
"schema": {
"$ref": "#/components/schemas/ArticleType81"
Expand All @@ -212,6 +196,7 @@
{
"name": "nullableArticleType81",
"in": "query",
"description": "Query parameter nullableArticleType81 description",
"required": false,
"schema": {
"nullable": true,
Expand All @@ -224,7 +209,7 @@
}
],
"responses": {
"default": {
"200": {
"description": ""
}
}
Expand Down Expand Up @@ -315,7 +300,7 @@
}
],
"responses": {
"default": {
"200": {
"description": ""
}
}
Expand Down Expand Up @@ -406,7 +391,7 @@
}
],
"responses": {
"default": {
"200": {
"description": ""
}
}
Expand Down Expand Up @@ -495,7 +480,7 @@
}
],
"responses": {
"default": {
"200": {
"description": ""
}
}
Expand Down Expand Up @@ -584,7 +569,7 @@
}
],
"responses": {
"default": {
"200": {
"description": ""
}
}
Expand Down Expand Up @@ -673,7 +658,7 @@
}
],
"responses": {
"default": {
"200": {
"description": ""
}
}
Expand Down Expand Up @@ -762,7 +747,7 @@
}
],
"responses": {
"default": {
"200": {
"description": ""
}
}
Expand Down Expand Up @@ -851,7 +836,7 @@
}
],
"responses": {
"default": {
"200": {
"description": ""
}
}
Expand Down Expand Up @@ -940,7 +925,7 @@
}
],
"responses": {
"default": {
"200": {
"description": ""
}
}
Expand Down Expand Up @@ -1029,7 +1014,7 @@
}
],
"responses": {
"default": {
"200": {
"description": ""
}
}
Expand Down
Loading

0 comments on commit 13559b1

Please sign in to comment.