Skip to content

Add richtext custom field support - #8

Merged
AndrianBdn merged 1 commit into
mainfrom
richtext-custom-fields
Jul 22, 2026
Merged

Add richtext custom field support#8
AndrianBdn merged 1 commit into
mainfrom
richtext-custom-fields

Conversation

@AndrianBdn

Copy link
Copy Markdown
Contributor

Summary

QA Sphere now supports rich text custom fields — notably the new Description field, exported as a custom_field_richtext_description column with a JSON-encoded value. This adds a richtext type so CSV import converters can target it properly instead of dumping source-TMS descriptions into Preconditions.

  • New CustomFieldTypeRichtext ("richtext"), included in validation, producing custom_field_richtext_<systemName> headers.
  • Removed the max=255 cap on CustomFieldValue.Value. Verified against the QA Sphere backend: custom field values are stored as TEXT with no length validation for any type — the cap never matched a real constraint. The only real limit is indirect: dropdown values must match a defined option, and option values are VARCHAR(255) — so 255 is now enforced for dropdown values only, giving early feedback on the one case that would actually fail import.
  • Documented the value format: richtext values are HTML (e.g. <p>…</p>, <pre><code>…</code></pre>), unlike Preconditions/Steps which take markdown. The backend sanitizes richtext via a bluemonday tag allowlist (disallowed markup is stripped). Doc comments on the type + a new "Custom Fields" README section.
  • Updated the TestCase.Preconditions doc comment to stop suggesting it for descriptions.

Verification

  • Output round-trips against a real QA Sphere export (backup_DES.csv from the DES demo project): same header, same {"value":"<p>…</p>"} cell format. The library additionally emits isDefault:false, which the import parser explicitly accepts (it reads only value/isDefault; extra keys are ignored) — existing text/dropdown output stays byte-identical.
  • New test builds a ~700-char multi-line HTML value with quotes/commas/newlines, parses the generated CSV back, and asserts the exact value survives escaping.
  • New test covers a 600-char text value now validating; the old >255 failure fixture was repointed at a dropdown field, where rejection remains correct.
  • make test and make lint pass.

QA Sphere now supports rich text custom fields (notably the Description
field), exported as custom_field_richtext_<systemName> columns. Add a
richtext type so CSV import converters can target it instead of dumping
descriptions into Preconditions.

- Add CustomFieldTypeRichtext, producing custom_field_richtext_* headers
- Drop the max=255 validation on CustomFieldValue.Value: the backend
  stores values as TEXT with no length validation for any field type.
  The only real constraint is that dropdown values must match a defined
  option (options are capped at 255 chars), so enforce 255 for dropdown
  values only
- Document that richtext values are HTML (sanitized on import via tag
  allowlist), unlike markdown Preconditions/Steps
- Update the Preconditions doc comment to stop suggesting it for
  descriptions
@AndrianBdn
AndrianBdn merged commit 2dc5240 into main Jul 22, 2026
1 check passed
@AndrianBdn
AndrianBdn deleted the richtext-custom-fields branch July 22, 2026 08:29
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.

1 participant