Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 8 additions & 11 deletions src/OpenApi/RelationFieldSchemaDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 `<Name>` 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 {
Expand Down
Loading