Skip to content

[FEATURE] Custom Reports: JSON export and import of report configurations - #2050

Open
Jonathon-Meney-Torq wants to merge 6 commits into
pimcore:2026.xfrom
TorqIT:feat/custom-report-json-import-export
Open

Jonathon-Meney-Torq wants to merge 6 commits into
pimcore:2026.xfrom
TorqIT:feat/custom-report-json-import-export

Conversation

@Jonathon-Meney-Torq

@Jonathon-Meney-Torq Jonathon-Meney-Torq commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Changes in this pull request

Closes pimcore/platform-version#505

Adds JSON export and import of custom report configurations, mirroring the Data Hub configuration export/import.

  • GET /bundle/custom-reports/config/{name}/export downloads the report configuration as a JSON file. Creation/modification dates and resolved user/role ids are excluded so the file is portable between environments.
  • POST /bundle/custom-reports/config/import accepts the exported JSON as a multipart file upload and creates a new report with the name stored in the file. Invalid JSON, a missing name or an already existing name return 422.
  • Both endpoints require the reports_config permission.
  • CustomReportRepository::cloneConfig() now shares the property whitelist and setter mapping with the new import path.

Additional info

Companion UI PR: pimcore/studio-ui-bundle#4120 (export action in the report tree context menu, import button in the sidebar toolbar).

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.

Copilot review overview

🟡 Changes recommended

Malformed property types can cause a 500 response or persist an invalid report, and core transfer behavior is untested.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

Adds portable JSON export/import for custom report configurations.

Changes:

  • Adds permission-protected import/export endpoints.
  • Centralizes transferable fields for import, export, and cloning.
  • Adds import validation tests and OpenAPI documentation.

Assessment: The service/repository boundary and internal APIs are appropriate. However, property types are not validated before persistence (CustomReportConfigService.php:164), and the shared transfer/clone behavior lacks regression coverage (CustomReportRepository.php:193-197).

File Description
translations/​studio_api_docs.en.yaml Documents the endpoints.
tests/​Unit/​Bundle/​CustomReport/​Service/​CustomReportConfigServiceTest.php Tests basic import scenarios.
src/​Bundle/​CustomReport/​Service/​CustomReportConfigServiceInterface.php Defines import/export operations.
src/​Bundle/​CustomReport/​Service/​CustomReportConfigService.php Implements JSON handling.
src/​Bundle/​CustomReport/​Repository/​CustomReportRepositoryInterface.php Defines transfer operations.
src/​Bundle/​CustomReport/​Repository/​CustomReportRepository.php Implements transferable-field mapping.
src/​Bundle/​CustomReport/​Controller/​Config/​ImportController.php Adds the import endpoint.
src/​Bundle/​CustomReport/​Controller/​Config/​ExportController.php Adds the export endpoint.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/Bundle/CustomReport/Service/CustomReportConfigService.php
Comment thread src/Bundle/CustomReport/Repository/CustomReportRepository.php Outdated

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.

Copilot review overview

🟡 Changes recommended

Malformed nested column data can be persisted before causing a 500 response, and export coverage is incomplete.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 High severity · 2 Low severity

Open (3)
Resolved since last review (2)

Comment thread src/Bundle/CustomReport/Service/TransferDataValidator.php
Comment thread src/Bundle/CustomReport/Service/CustomReportConfigService.php
Comment thread src/Bundle/CustomReport/Util/TransferableProperties.php Outdated

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.

Copilot review overview

🟡 Changes recommended

Malformed column configurations can be persisted before response hydration fails.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 High severity

Open (1)
Resolved since last review (3)

Comment thread src/Bundle/CustomReport/Service/TransferDataValidator.php

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.

Copilot review overview

🟡 Changes recommended

Malformed adapter metadata can be persisted before response hydration fails.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 High severity

Open (1)
Resolved since last review (1)

Comment thread src/Bundle/CustomReport/Service/TransferDataValidator.php Outdated

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.

Copilot review overview

🟡 Changes recommended

The importer can reject column configurations emitted unchanged by the new exporter.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 High severity

Open (1)
Resolved since last review (1)

Comment thread src/Bundle/CustomReport/Util/TransferableProperties.php
@sonarqubecloud

Copy link
Copy Markdown

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.

Copilot review overview

🔵 Needs a closer look

Export encoding exceptions must be translated and documented through the API contract.

Review effort: Balanced
Findings: None

Resolved since last review (1)
Previously missed (1)

In code that hasn't changed since last review

Medium severity Handle JsonException from non-encodable configuration values

src/​Bundle/​CustomReport/​Service/​CustomReportConfigService.php:140

JSON_THROW_ON_ERROR can throw JsonException for malformed UTF-8 or otherwise non-encodable persisted configuration values, but this export path neither translates that exception nor declares it in the service/controller contract. This bypasses the repository's API exception handling and produces an undocumented generic failure. Catch and chain it in the appropriate domain/API exception, as src/Class/Service/BulkExport/BulkExportService.php:219-225 does, and update the related @throws/OpenAPI response declarations.

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.

Export and Upload of Reports

2 participants