Skip to content

Make generated component docs match customValidationMessage(s) support - #476

Draft
alexluckett wants to merge 1 commit into
bugfix/custom-validation-message-override-testsfrom
audit/custom-validation-message-docs
Draft

alexluckett wants to merge 1 commit into
bugfix/custom-validation-message-override-testsfrom
audit/custom-validation-message-docs

Conversation

@alexluckett

Copy link
Copy Markdown
Contributor

The generated component docs list customValidationMessage and customValidationMessages on every component whose forms-model type declares them, even where the engine ignores the option. This change makes the doc generator use the same support data the tests already assert against, so the docs and the tests cannot drift apart.

Architecture

The lists recording which ComponentTypes read customValidationMessage and customValidationMessages used to live as private constants in the two test files. They now live in one shared module, customValidationMessageSupport.ts, imported by both test files and by generate-component-docs.js. Each test file keeps its own "accounts for every ComponentType" guard test, which now guards the shared lists instead of a local copy - a component whose support changes without a matching list update still fails a test.

Key changes

  • Extract SUPPORTS_SINGULAR_MESSAGE, IGNORES_SINGULAR_MESSAGE, NO_SINGULAR_MESSAGE_OPTION, SUPPORTS_PLURAL_MESSAGES, IGNORES_PLURAL_MESSAGES and NO_PLURAL_MESSAGES_OPTION into customValidationMessageSupport.ts.
  • customValidationMessage.test.ts and customValidationMessages.test.ts import these lists instead of declaring their own, removing the duplicate constants.
  • generate-component-docs.js imports the same lists. customValidationMessages is declared on the shared FormFieldBase options type, so every field component inherits it whether it reads it or not - the generator now omits that row for components that ignore it, rather than documenting an option with no effect. customValidationMessage is added per-component rather than inherited, so a component that declares it but ignores it keeps the row with a note explaining it has no effect.

The generated component docs listed customValidationMessage and
customValidationMessages on every component whose forms-model type
declares them, even where the engine ignores the option - 11 of 28
component types documented an option with no effect. The lists proving
which components actually honour each option already existed as private
constants in the two test files, so extracting them into a shared module
lets the doc generator use the same source of truth: it now omits the
customValidationMessages row for components that only inherit it, and
appends a no-effect note to customValidationMessage where a component
declares it but ignores it.
@sonarqubecloud

sonarqubecloud Bot commented Oct 5, 2026

Copy link
Copy Markdown

@alexluckett
alexluckett added this pull request to stack #477 October 5, 2026 14:06

This branch has not been deployed

No deployments
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