Skip to content

[Studio] Fix blank unit selection for the static Quantity Value transformer - #682

Open
ValeriaMaltseva wants to merge 5 commits into
2026.2from
fix/quantity-value-transformer-unit-list
Open

[Studio] Fix blank unit selection for the static Quantity Value transformer#682
ValeriaMaltseva wants to merge 5 commits into
2026.2from
fix/quantity-value-transformer-unit-list

Conversation

@ValeriaMaltseva

Copy link
Copy Markdown

Problem

The unit select of the Quantity Value transformer is always empty when Unit source is set to Static.

Fixes pimcore/platform-version#148

Root cause

UnitDataResponse documented its list under the OpenAPI property name UnitList, while the
serializer emits the actual property name — unitList:

{"unitList":[{"unitId":"kg","abbreviation":"kg"}],"additionalAttributes":[]}

The generated API client therefore typed the response as UnitList, and
quantity-value-transformer-form.tsx read unitData?.UnitList, which was always undefined
empty option list → blank select.

The schema annotation was already corrected to unitList in 307aeb9 (documented in the 2026.2
upgrade guide under API Schema Changes), but the committed OpenAPI snapshot and the generated
client still carried the old name — so the type checker agreed with the broken access and never
flagged it.

Change

  • assets/studio/build/api/docs.jsonopenapi.json — snapshot property UnitListunitList
  • data-importer-api-slice.gen.ts — regenerated via npm run build-api-client (one-line diff, no drift)
  • quantity-value-transformer-form.tsx — reads unitData?.unitList
  • tests/unit/UnitDataResponseTest.php — regression test: the documented OpenAPI property name must
    match the key the serializer actually emits

Verification

  • Before the component edit, npm run check-types failed exactly at the bug site
    (Property 'UnitList' does not exist on type 'BundleDataImporterUnitDataResponse'. Did you mean 'unitList'?).
  • After the fix, npm run check-types and npm run lint are clean.
  • The regression test's logic was executed against the real DTO: it passes on the current schema and
    fails with missing: UnitList against a replica of the pre-fix schema.
  • The Codeception suite was not run locally (needs the Docker test env + product-registration
    credentials) — CI validates it.
  • No frontend build artifact is committed; the "Studio Frontend Build" workflow regenerates it.

Manual test

Data Importer config → mapping to a Quantity Value field → add the Quantity Value transformer →
set Unit source to Static → the Unit select lists all quantity-value units and is searchable.

Note for consumers

Anyone who worked around this by renaming unitList back to UnitList in the response (see the
issue comment) must drop that workaround.

Follow-up

2026.x carries the identical stale UnitList in both files — covered by the usual
2026.2 → 2026.x forward-merge after this lands.

ValeriaMaltseva and others added 2 commits August 24, 2026 21:01
…former

The unit select of the Quantity Value transformer was always empty when the
unit source was set to "Static".

`UnitDataResponse` documented its list under the OpenAPI property name
`UnitList`, while the serializer emits the actual property name `unitList`.
The generated API client therefore typed the response as `UnitList` and the
transformer form read `unitData?.UnitList`, which was always undefined.

The schema annotation was already corrected to `unitList`, but the committed
OpenAPI snapshot and the generated client still carried the old name, so the
type checker agreed with the broken access. Refresh the snapshot property,
regenerate the client and read `unitList` in the transformer form.

Consumers that worked around this by renaming `unitList` back to `UnitList`
in the response must drop that workaround.

Fixes pimcore/platform-version#148

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings August 25, 2026 09:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes static Quantity Value unit selection by aligning the OpenAPI client and UI with the serialized unitList property.

Changes:

  • Corrects UnitList to unitList.
  • Adds DTO serialization/schema regression tests.
  • Regenerates Studio frontend artifacts and manifests.

Reviewed changes

Copilot reviewed 11 out of 32 changed files in this pull request and generated no comments.

Show a summary per file
File Description
assets/studio/build/api/docs.jsonopenapi.json Corrects the schema property name.
assets/studio/js/src/modules/data-importer/data-importer-api-slice.gen.ts Regenerates the API response type.
assets/studio/js/src/modules/data-importer/dynamic-types/transformer/quantity-value/quantity-value-transformer-form.tsx Reads units from unitList.
tests/unit/UnitDataResponseTest.php Tests schema and serialization consistency.
src/Resources/public/studio/build/a0ef.../entrypoints.json Adds regenerated entrypoints.
src/Resources/public/studio/build/a0ef.../exposeRemote.js Updates the remote bundle path.
src/Resources/public/studio/build/a0ef.../main.html Updates generated script paths.
src/Resources/public/studio/build/a0ef.../manifest.json Adds the regenerated asset manifest.
src/Resources/public/studio/build/a0ef.../mf-manifest.json Updates federation metadata.
src/Resources/public/studio/build/a0ef.../mf-stats.json Updates federation statistics.
src/Resources/public/studio/build/a0ef.../static/js/remoteEntry.js Regenerates the federation entry.
src/Resources/public/studio/build/a0ef.../static/js/remoteEntry.js.LICENSE.txt Adds generated licenses.
src/Resources/public/studio/build/a0ef.../static/js/main.827b06d5.js.LICENSE.txt Adds generated license metadata.
src/Resources/public/studio/build/a0ef.../static/js/109.4563ef16.js.LICENSE.txt Adds generated licenses.
src/Resources/public/studio/build/a0ef.../static/js/async/67.8469aaea.js Adds generated dependency chunk.
src/Resources/public/studio/build/a0ef.../static/js/async/67.8469aaea.js.LICENSE.txt Adds chunk licenses.
src/Resources/public/studio/build/a0ef.../static/js/async/132.c328628b.js Adds generated dependency chunk.
src/Resources/public/studio/build/a0ef.../static/js/async/272.5aa86da5.js Adds generated dependency chunk.
src/Resources/public/studio/build/a0ef.../static/js/async/272.5aa86da5.js.LICENSE.txt Adds chunk licenses.
src/Resources/public/studio/build/a0ef.../static/js/async/359.ef7a6289.js.LICENSE.txt Adds chunk licenses.
src/Resources/public/studio/build/a0ef.../static/js/async/658.b1390ae9.js Adds generated dependency chunk.
src/Resources/public/studio/build/a0ef.../static/js/async/668.1ae87f0f.js.LICENSE.txt Adds chunk licenses.
src/Resources/public/studio/build/a0ef.../static/js/async/745.56a11b0d.js.LICENSE.txt Adds chunk licenses.
src/Resources/public/studio/build/a0ef.../static/js/async/__federation_expose_default_export.619777ef.js.LICENSE.txt Adds generated license metadata.
src/Resources/public/studio/build/9d52.../entrypoints.json Removes obsolete entrypoints.
src/Resources/public/studio/build/9d52.../manifest.json Removes the obsolete manifest.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

ValeriaMaltseva and others added 2 commits August 25, 2026 11:39
The committed OpenAPI snapshot predated several `#[Property]` annotations in
the bundle's schema classes. The generated API client therefore carried no
descriptions for `currentConfig.label` and `userPermissions.update`/`delete`,
and typed `dataPreview.data` as `any`.

Refresh only the `BundleDataImporter*` schemas in the snapshot — 21 additions,
all property descriptions and examples plus the `dataPreview.data` string type
— and regenerate the client. Nothing outside the data-importer schemas is
touched, so the snapshot keeps its existing 403 paths and 369 components.

`CalculateTransformationResultTypeParameters::$currentConfig` documents
`dataSourceIndex` items as `integer`, which contradicts both the frontend
(string column identifiers throughout) and the bundle's own
`ColumnHeadersResponse`, where `id` and `dataIndex` are `string`. That one
property is deliberately left un-refreshed so `dataSourceIndex` stays `any`
until the annotation itself is corrected.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants