Skip to content

Commit 6e9c3d9

Browse files
committed
[JsonSchema] Only build schemas which can be serialized / deserialied
1 parent d4d2cd4 commit 6e9c3d9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/JsonSchema/SchemaFactory.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ public function buildSchema(string $className, string $format = 'json', string $
6565

6666
[$operation, $serializerContext, $validationGroups, $inputOrOutputClass] = $metadata;
6767

68+
if ('input' === $type && !($operation?->canDeserialize() ?? true)) {
69+
return $schema;
70+
}
71+
72+
if ('output' === $type && !($operation?->canSerialize() ?? true)) {
73+
return $schema;
74+
}
75+
6876
$version = $schema->getVersion();
6977
$definitionName = $this->buildDefinitionName($className, $format, $inputOrOutputClass, $operation, $serializerContext);
7078

0 commit comments

Comments
 (0)