diff --git a/CHANGELOG.md b/CHANGELOG.md index 38127e1..2a9b77e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ ### Fixed +- `RelationFieldSchemaDecorator` also decorates output (read) schemas: `x-collection`, `x-label-property`, `x-value-property`, `x-search-property` and `x-resource-class` were only added to input schemas, so clients building forms from the read schema (resources with serialization groups have no plain schema) got no type-ahead for `iri-reference` fields - Duplicate `partial_uuid_item_provider` node in the bundle configuration tree (and the duplicate parameter assignment in the extension) ## 0.3.1 and earlier diff --git a/src/OpenApi/RelationFieldSchemaDecorator.php b/src/OpenApi/RelationFieldSchemaDecorator.php index 001db2a..14c0679 100644 --- a/src/OpenApi/RelationFieldSchemaDecorator.php +++ b/src/OpenApi/RelationFieldSchemaDecorator.php @@ -17,6 +17,7 @@ /** * Decorator that adds OpenAPI x-* extensions to relation properties for autocomplete rendering. + * Applies to input and output schemas alike. * * Automatically detects Doctrine relations and adds: * - x-collection: Collection endpoint URL @@ -69,17 +70,13 @@ public function buildSchema( $forceCollection ); - // Only add extensions for INPUT schemas (forms) - if ($type !== Schema::TYPE_INPUT) { - $this->logger->debug('Skipping RelationFieldSchemaDecorator for non-INPUT schema', [ - 'className' => $className, - 'type' => $type - ]); - return $schema; - } - - $this->logger->debug('Processing RelationFieldSchemaDecorator for INPUT schema', [ - 'className' => $className + // Input AND output schemas are decorated: clients that build forms from + // the read schema (the plain `` schema is only emitted when a + // resource has no serialization groups) would otherwise never see the + // hints and render a bare string input instead of the type-ahead. + $this->logger->debug('Processing RelationFieldSchemaDecorator', [ + 'className' => $className, + 'type' => $type ]); try {