Skip to content

Commit 5c1d634

Browse files
committed
Merge 3.4
2 parents dba9de1 + 2055e08 commit 5c1d634

File tree

4 files changed

+42
-21
lines changed

4 files changed

+42
-21
lines changed

CHANGELOG.md

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
* [97cdb6b3f](https://github.com/api-platform/core/commit/97cdb6b3f43471789e096c9dc3a0c3c7b6d4e43c) fix(state): remove ProcessorInterface laravel specific type
88
* [b12a0d005](https://github.com/api-platform/core/commit/b12a0d005fda58a162b82a3574e6ee877838a55b) fix(graphql): register types for parameter args (#6895)
99

10-
### Features
11-
1210
## v4.0.13
1311

1412
### Bug fixes
@@ -19,8 +17,6 @@
1917

2018
Also contains [v3.4.10 changes](#v3410).
2119

22-
### Features
23-
2420
## v4.0.12
2521

2622
### Bug fixes
@@ -32,16 +28,12 @@ Also contains [v3.4.10 changes](#v3410).
3228

3329
Also contains [v3.4.9 changes](#v349).
3430

35-
### Features
36-
3731
## v4.0.11
3832

3933
### Bug fixes
4034

4135
* [af66075fd](https://github.com/api-platform/core/commit/af66075fdd6b83bdebc1c4ca33cc0ab7e1a7f8af) fix(laravel): fix foregin keys (relations) beeing in attributes (#6843)
4236

43-
### Features
44-
4537
* [2d59c6369](https://github.com/api-platform/core/commit/2d59c63699b4602cfe4d62504896c6d4121c1be4) feat(laravel): belongs to many relations (#6818)
4638

4739
Also contains [v3.4.8 changes](#v348).
@@ -56,8 +48,6 @@ Also contains [v3.4.8 changes](#v348).
5648

5749
Also contains [v3.4.7 changes](#v347).
5850

59-
### Features
60-
6151
## v4.0.9
6252

6353
### Bug fixes
@@ -68,16 +58,12 @@ Also contains [v3.4.7 changes](#v347).
6858

6959
Also contains [v3.4.6 changes](#v346).
7060

71-
### Features
72-
7361
## v4.0.8
7462

7563
### Bug fixes
7664

7765
* [dddb97075](https://github.com/api-platform/core/commit/dddb97075af9c6e2517e1881b803c9d31a1913cf) fix(symfony): default formats order (#6780)
7866

79-
### Features
80-
8167
## v4.0.7
8268

8369
### Bug fixes
@@ -89,8 +75,6 @@ Also contains [v3.4.6 changes](#v346).
8975
* [736ca045e](https://github.com/api-platform/core/commit/736ca045e6832f04aaa002ddd7b85c55df4696bb) fix(validator): allow to pass both a ConstraintViolationList and a previous exception (#6762)
9076
* [9ac3661b6](https://github.com/api-platform/core/commit/9ac3661b6a75255832203b87a9ba7994add64061) fix(hydra): store and use hydra context in a local variable (#6765)
9177

92-
### Features
93-
9478
## v4.0.6
9579

9680
### Bug fixes
@@ -101,8 +85,6 @@ Also contains [v3.4.6 changes](#v346).
10185
* [67c5a2a24](https://github.com/api-platform/core/commit/67c5a2a2463bca94f0997b4fab1248a08994465b) fix(laravel): jsonapi error serialization (#6755)
10286
* [ac6f667f3](https://github.com/api-platform/core/commit/ac6f667f301f6c4c399a707faf00567239bd98d8) fix(laravel): collection relations other than HasMany (#6737)
10387

104-
### Features
105-
10688
* [cecd77149](https://github.com/api-platform/core/commit/cecd77149795c1a455ac72bc3ed0606413e69900) feat(laravel): use laravel cache setting (#6751)
10789

10890
## v4.0.5
@@ -112,8 +94,6 @@ Also contains [v3.4.6 changes](#v346).
11294
* [4171d5f9c](https://github.com/api-platform/core/commit/4171d5f9cd41731b857c53a186270ba0626baedf) fix(graphql): register query parameter arguments with filters (#6726)
11395
* [48ab53816](https://github.com/api-platform/core/commit/48ab53816c55e6116aa64ac81f522f4b7b9bb9f6) fix(laravel): make command writes to app instead of src (#6723)
11496

115-
### Features
116-
11797
## v4.0.4
11898

11999
### Bug fixes
@@ -257,6 +237,12 @@ Notes:
257237

258238
* [0d5f35683](https://github.com/api-platform/core/commit/0d5f356839eb6aa9f536044abe4affa736553e76) feat(laravel): laravel component (#5882)
259239

240+
## v3.4.15
241+
242+
### Bug fixes
243+
244+
* [ab03b5544](https://github.com/api-platform/core/commit/ab03b5544f742b98a39cc23fc157f1be7a2e0c63) fix(openapi): typing issue with `openapiContext` in `#[ApiProperty]` (#6910)
245+
260246
## v3.4.14
261247

262248
### Bug fixes

src/JsonSchema/Metadata/Property/Factory/SchemaPropertyMetadataFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function create(string $resourceClass, string $property, array $options =
106106
// never override the following keys if at least one is already set or if there's a custom openapi context
107107
if ([] === $types
108108
|| ($propertySchema['type'] ?? $propertySchema['$ref'] ?? $propertySchema['anyOf'] ?? $propertySchema['allOf'] ?? $propertySchema['oneOf'] ?? false)
109-
|| ($propertyMetadata->getOpenapiContext() ?? false)
109+
|| \array_key_exists('type', $propertyMetadata->getOpenapiContext() ?? [])
110110
) {
111111
return $propertyMetadata->withSchema($propertySchema);
112112
}

src/JsonSchema/Tests/Fixtures/DummyWithCustomOpenApiContext.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,10 @@ class DummyWithCustomOpenApiContext
3030
{
3131
#[ApiProperty(openapiContext: ['type' => 'object', 'properties' => ['alpha' => ['type' => 'integer']]])]
3232
public $acme;
33+
34+
#[ApiProperty(openapiContext: ['description' => 'My description'])]
35+
public bool $foo;
36+
37+
#[ApiProperty(openapiContext: ['iris' => 'https://schema.org/Date'])]
38+
public \DateTimeImmutable $bar;
3339
}

src/JsonSchema/Tests/Metadata/Property/Factory/SchemaPropertyMetadataFactoryTest.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,33 @@ public function testWithCustomOpenApiContext(): void
4949
$apiProperty = $schemaPropertyMetadataFactory->create(DummyWithCustomOpenApiContext::class, 'acme');
5050
$this->assertEquals([], $apiProperty->getSchema());
5151
}
52+
53+
public function testWithCustomOpenApiContextWithoutTypeDefinition(): void
54+
{
55+
$resourceClassResolver = $this->createMock(ResourceClassResolverInterface::class);
56+
$apiProperty = new ApiProperty(
57+
openapiContext: ['description' => 'My description'],
58+
builtinTypes: [new Type(builtinType: 'bool')],
59+
);
60+
$decorated = $this->createMock(PropertyMetadataFactoryInterface::class);
61+
$decorated->expects($this->once())->method('create')->with(DummyWithCustomOpenApiContext::class, 'foo')->willReturn($apiProperty);
62+
$schemaPropertyMetadataFactory = new SchemaPropertyMetadataFactory($resourceClassResolver, $decorated);
63+
$apiProperty = $schemaPropertyMetadataFactory->create(DummyWithCustomOpenApiContext::class, 'foo');
64+
$this->assertEquals([
65+
'type' => 'boolean',
66+
], $apiProperty->getSchema());
67+
68+
$apiProperty = new ApiProperty(
69+
openapiContext: ['iris' => 'https://schema.org/Date'],
70+
builtinTypes: [new Type(builtinType: 'object', class: \DateTimeImmutable::class)],
71+
);
72+
$decorated = $this->createMock(PropertyMetadataFactoryInterface::class);
73+
$decorated->expects($this->once())->method('create')->with(DummyWithCustomOpenApiContext::class, 'bar')->willReturn($apiProperty);
74+
$schemaPropertyMetadataFactory = new SchemaPropertyMetadataFactory($resourceClassResolver, $decorated);
75+
$apiProperty = $schemaPropertyMetadataFactory->create(DummyWithCustomOpenApiContext::class, 'bar');
76+
$this->assertEquals([
77+
'type' => 'string',
78+
'format' => 'date-time',
79+
], $apiProperty->getSchema());
80+
}
5281
}

0 commit comments

Comments
 (0)