Skip to content

Commit

Permalink
[JsonSchema] Only build schemas which can be serialized / deserialied
Browse files Browse the repository at this point in the history
  • Loading branch information
GeLoLabs committed Jun 1, 2024
1 parent 73a4c32 commit 97093c0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/JsonSchema/SchemaFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ public function buildSchema(string $className, string $format = 'json', string $
return $schema;
}

if ('input' === $type && !($operation?->canDeserialize() ?? true)) {
return $schema;
}

if ('output' === $type && !($operation?->canSerialize() ?? true)) {
return $schema;
}

$validationGroups = $operation ? $this->getValidationGroups($operation) : [];
$version = $schema->getVersion();
$definitionName = $this->definitionNameFactory->create($className, $format, $inputOrOutputClass, $operation, $serializerContext);
Expand Down

0 comments on commit 97093c0

Please sign in to comment.