Skip to content

Commit

Permalink
fix invalid context being passed
Browse files Browse the repository at this point in the history
  • Loading branch information
DjordyKoert committed Oct 18, 2024
1 parent 223954d commit 0327105
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/ModelDescriber/ObjectModelDescriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public function describe(Model $model, OA\Schema $schema)
throw new \RuntimeException('The PropertyInfo component is missing the "getType" method. Are you running on version 7.1?');
}

$type = $this->propertyInfo->getType($class, $propertyName, $context);
$type = $this->propertyInfo->getType($class, $propertyName);
if (null === $type) {
throw new \LogicException(sprintf('The PropertyInfo component was not able to guess the type of %s::$%s. You may need to add a `@var` annotation or use `@OA\Property(type="")` to make its type explicit.', $class, $propertyName));
}
Expand All @@ -193,11 +193,11 @@ public function describe(Model $model, OA\Schema $schema)
$this->propertyDescriber->setModelRegistry($this->modelRegistry);
}

if (!$this->propertyDescriber->supports($type, $context)) {
throw new \Exception(sprintf('Type "%s" is not supported in %s::$%s. You may use the `@OA\Property(type="")` annotation to specify it manually.', $type->__toString(), $model->getType()->getClassName(), $propertyName));
if (!$this->propertyDescriber->supports($type, $model->getSerializationContext())) {
throw new \Exception(sprintf('Type "%s" $model->getSerializationContext() not supported in %s::$%s. You may use the `@OA\Property(type="")` annotation to specify it manually.', $type->__toString(), $model->getType()->getClassName(), $propertyName));
}

$this->propertyDescriber->describe($type, $property, $context);
$this->propertyDescriber->describe($type, $property, $model->getSerializationContext());
} else {
$types = $this->propertyInfo->getTypes($class, $propertyName);
if (null === $types || 0 === count($types)) {
Expand Down

0 comments on commit 0327105

Please sign in to comment.