|
18 | 18 | use ApiPlatform\Metadata\CollectionOperationInterface; |
19 | 19 | use ApiPlatform\Metadata\HttpOperation; |
20 | 20 | use ApiPlatform\Metadata\Operation; |
21 | | -use ApiPlatform\Metadata\Patch; |
22 | 21 | use ApiPlatform\Metadata\Property\Factory\PropertyMetadataFactoryInterface; |
23 | 22 | use ApiPlatform\Metadata\Property\Factory\PropertyNameCollectionFactoryInterface; |
24 | 23 | use ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface; |
|
34 | 33 | final class SchemaFactory implements SchemaFactoryInterface, SchemaFactoryAwareInterface |
35 | 34 | { |
36 | 35 | use ResourceMetadataTrait; |
37 | | - |
38 | | - private const PATCH_SCHEMA_POSTFIX = '.patch'; |
39 | | - |
40 | 36 | private ?TypeFactoryInterface $typeFactory = null; |
41 | 37 | private ?SchemaFactoryInterface $schemaFactory = null; |
42 | 38 | // Edge case where the related resource is not readable (for example: NotExposed) but we have groups to read the whole related object |
@@ -92,12 +88,6 @@ public function buildSchema(string $className, string $format = 'json', string $ |
92 | 88 | return $schema; |
93 | 89 | } |
94 | 90 |
|
95 | | - $isJsonMergePatch = 'json' === $format && $operation instanceof Patch && Schema::TYPE_INPUT === $type; |
96 | | - |
97 | | - if ($isJsonMergePatch) { |
98 | | - $definitionName .= self::PATCH_SCHEMA_POSTFIX; |
99 | | - } |
100 | | - |
101 | 91 | if (!isset($schema['$ref']) && !isset($schema['type'])) { |
102 | 92 | $ref = Schema::VERSION_OPENAPI === $version ? '#/components/schemas/'.$definitionName : '#/definitions/'.$definitionName; |
103 | 93 | if ($forceCollection || ('POST' !== $method && $operation instanceof CollectionOperationInterface)) { |
@@ -146,7 +136,7 @@ public function buildSchema(string $className, string $format = 'json', string $ |
146 | 136 | } |
147 | 137 |
|
148 | 138 | $normalizedPropertyName = $this->nameConverter ? $this->nameConverter->normalize($propertyName, $inputOrOutputClass, $format, $serializerContext) : $propertyName; |
149 | | - if ($propertyMetadata->isRequired() && !$isJsonMergePatch) { |
| 139 | + if ($propertyMetadata->isRequired()) { |
150 | 140 | $definition['required'][] = $normalizedPropertyName; |
151 | 141 | } |
152 | 142 |
|
|
0 commit comments