Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JsonSchema] Only build schemas which can be serialized / deserialied #6276

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/JsonSchema/SchemaFactory.php
Expand Up @@ -65,6 +65,14 @@

[$operation, $serializerContext, $validationGroups, $inputOrOutputClass] = $metadata;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To save you digging too hard, and easing the rebase, after my last PR these are now assigned here:

if (!$this->isResourceClass($className)) {
$operation = null;
$inputOrOutputClass = $className;
$serializerContext ??= [];
} else {
$operation = $this->findOperation($className, $type, $operation, $serializerContext);
$inputOrOutputClass = $this->findOutputClass($className, $type, $operation, $serializerContext);
$serializerContext ??= $this->getSerializerContext($operation, $type);
}


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

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

Check warning on line 73 in src/JsonSchema/SchemaFactory.php

View check run for this annotation

Codecov / codecov/patch

src/JsonSchema/SchemaFactory.php#L73

Added line #L73 was not covered by tests
}

$version = $schema->getVersion();
$definitionName = $this->buildDefinitionName($className, $format, $inputOrOutputClass, $operation, $serializerContext);

Expand Down