Skip to content

[#74418] Normalize Formattable custom fields on read - #19

Open
myabc wants to merge 1 commit into
feature/CLI-12-json-wp-workflowsfrom
feature/CLI-15-formattable-read
Open

[#74418] Normalize Formattable custom fields on read#19
myabc wants to merge 1 commit into
feature/CLI-12-json-wp-workflowsfrom
feature/CLI-15-formattable-read

Conversation

@myabc

@myabc myabc commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

🤖 This PR was authored by an agent on behalf of @myabc.

Ticket

https://community.openproject.org/wp/CLI-15

What are you trying to accomplish?

Inspect payloads currently return Formattable custom field values as {format, raw, html} objects, which does not round-trip against the raw-text write contract used elsewhere (e.g. description).

What approach did you choose and why?

Normalize Formattable custom field values to their raw markdown string when building the work package details payload, using the schema to identify which fields are Formattable. This mirrors how description is already flattened to raw text.

This PR is stacked on #18 and should merge after it.

Copilot AI review requested due to automatic review settings July 27, 2026 07:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the work package inspect JSON payload construction to normalize Formattable custom field values from {format, raw, html} objects into their raw markdown string, aligning the read shape with the existing raw-text write contract (similar to how description is already flattened).

Changes:

  • Normalize Formattable custom field values to raw strings when building WorkPackageDetails.Fields.
  • Add targeted inspect tests covering Formattable normalization, pass-through behavior for non-Formattable dict fields, already-string values, and empty custom field maps.

Reviewed changes

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

File Description
components/resources/work_packages/details.go Adds schema-driven normalization so Formattable custom fields are flattened to raw markdown strings in the inspect payload.
components/resources/work_packages/details_test.go Adds regression tests ensuring normalization happens only for Formattable fields and does not affect other field shapes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Formattable custom field values in inspect payloads collapse to their
raw markdown text, so reads round-trip cleanly with the raw-text write
contract.

https://community.openproject.org/wp/CLI-15
@myabc
myabc force-pushed the feature/CLI-15-formattable-read branch from 7ddbd1b to bfae423 Compare July 27, 2026 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants