Fix /api/graphql 500: Site settings title separator values are GraphQL enum names

The titleSeparator select stored '|', '–', '-', '·', '/'. Select values become
GraphQL enum names; '|', '–', '·' are invalid and '-' and '/' collide on '_', so
every project's /api/graphql answered 500 since 1.0.1 (admin/REST unaffected).

- Values are now pipe/endash/hyphen/middot/slash (same labels); TITLE_SEPARATORS
  and titleSeparatorChar map them to the character; titles accept old characters
  and custom project values literally
- Field afterRead/beforeChange turn an old stored character into its name
- MongoDB: rewritten at start (migrateTitleSeparator); Postgres: titleSeparatorSql()
  for the generated migration (verified up/down/up against Postgres 16)
- Test builds the full plugin GraphQL schema and fails on invalid or duplicate
  enum names; unit tests for the mapping, hooks, SQL and Mongo rewrite
- CHANGELOG Unreleased (Fixed + upgrade step 5), seo.md, ipal-upgrade, api.md

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-10-29 12:06:55 +01:00
co-authored by Claude Opus 5.5
parent f57d089f55
commit bb10fb10fd
13 changed files with 385 additions and 9 deletions
+8 -1
View File
@@ -61,7 +61,7 @@ are other fields there already (slug, roles), leaving an empty SEO tab.
No code, per site (Site settings → General):
- **Title Order** — `Page first` (O nas | Acme) or `Site first` (Acme | O nas)
- **Title Separator** — `|` `–` `-` `·` `/`
- **Title Separator** — `|` `–` `-` `·` `/`, stored as `pipe`, `endash`, `hyphen`, `middot`, `slash`
Per page (SEO tab):
@@ -70,6 +70,13 @@ Per page (SEO tab):
Default: `Title | Site name`.
The stored values are names, not the characters, because select values become GraphQL enum names and `|` is not a
valid one. Up to 1.14.4 the character itself was stored, which made `/api/graphql` answer 500. An old character is
still understood. For a custom title builder, `titleSeparatorChar(settings.titleSeparator)` returns the character
(`TITLE_SEPARATORS` is the map; any other value is used literally, so a project can add its own options with
GraphQL-safe values). For the Postgres upgrade, the migration needs `titleSeparatorSql()`: see the CHANGELOG
(Unreleased → What projects must update).
### Where the "Title" comes from (source priority)
The page title (the part before the site name) comes from, in order: