Conversation
…allback) (#64552) * Add .worktrees/ to .gitignore * Make Theme tokens field optional to allow CSS-only or empty theme configs * Add integration test: CSS-only theme passes config endpoint validation * Docs: note that Theme tokens is optional, empty config restores OSS defaults * Improve CSS-only theme test: also assert icon fields absent from response * Add newsfragment for optional theme tokens * Rename newsfragment to PR #64552 * Fix TypeScript errors in createTheme for optional tokens support The API schema for Theme became opaque ({[key: string]: unknown}) after @model_serializer was added to Theme in Python to exclude None values. This broke theme.ts in two ways: - userTheme.tokens typed as unknown, not assignable to TokenDefinition - mergeConfigs() called with undefined, which it doesn't accept Fix by conditionally spreading tokens/globalCss (guarding for CSS-only themes) and casting to Record<string, unknown> which is assignable to TokenDefinition. Use conditional mergeConfigs call to avoid passing undefined. * Fix Theme OpenAPI schema collapsing to untyped object The @model_serializer(mode="wrap") on Theme and ThemeColors caused Pydantic to generate additionalProperties:true for both models in the OpenAPI spec, losing typed fields (tokens, globalCss, icon) and breaking TypeScript types to {[key: string]: unknown}. Fix: remove wrap serializers from Theme/ThemeColors; add @field_serializer("theme") to ConfigResponse with model_dump(exclude_none=True) to preserve None-exclusion behavior scoped to the theme field only. Add ConfigDict(json_schema_mode_override="validation") to ConfigResponse so schema generation uses type annotations rather than the field serializer's dict return type, keeping the $ref: Theme link intact. Also removes unrelated .worktrees/ entry from .gitignore. (cherry picked from commit a06896f) Co-authored-by: Constance Martineau <constance.alyssa.martineau@gmail.com>
1 task
bbovenzi
approved these changes
Apr 7, 2026
vatsrahul1001
pushed a commit
that referenced
this pull request
Apr 8, 2026
…allback) (#64552) (#64852) * Add .worktrees/ to .gitignore * Make Theme tokens field optional to allow CSS-only or empty theme configs * Add integration test: CSS-only theme passes config endpoint validation * Docs: note that Theme tokens is optional, empty config restores OSS defaults * Improve CSS-only theme test: also assert icon fields absent from response * Add newsfragment for optional theme tokens * Rename newsfragment to PR #64552 * Fix TypeScript errors in createTheme for optional tokens support The API schema for Theme became opaque ({[key: string]: unknown}) after @model_serializer was added to Theme in Python to exclude None values. This broke theme.ts in two ways: - userTheme.tokens typed as unknown, not assignable to TokenDefinition - mergeConfigs() called with undefined, which it doesn't accept Fix by conditionally spreading tokens/globalCss (guarding for CSS-only themes) and casting to Record<string, unknown> which is assignable to TokenDefinition. Use conditional mergeConfigs call to avoid passing undefined. * Fix Theme OpenAPI schema collapsing to untyped object The @model_serializer(mode="wrap") on Theme and ThemeColors caused Pydantic to generate additionalProperties:true for both models in the OpenAPI spec, losing typed fields (tokens, globalCss, icon) and breaking TypeScript types to {[key: string]: unknown}. Fix: remove wrap serializers from Theme/ThemeColors; add @field_serializer("theme") to ConfigResponse with model_dump(exclude_none=True) to preserve None-exclusion behavior scoped to the theme field only. Add ConfigDict(json_schema_mode_override="validation") to ConfigResponse so schema generation uses type annotations rather than the field serializer's dict return type, keeping the $ref: Theme link intact. Also removes unrelated .worktrees/ entry from .gitignore. (cherry picked from commit a06896f) Co-authored-by: Constance Martineau <constance.alyssa.martineau@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add .worktrees/ to .gitignore
Make Theme tokens field optional to allow CSS-only or empty theme configs
Add integration test: CSS-only theme passes config endpoint validation
Docs: note that Theme tokens is optional, empty config restores OSS defaults
Improve CSS-only theme test: also assert icon fields absent from response
Add newsfragment for optional theme tokens
Rename newsfragment to PR Allow UI theme config without tokens (CSS-only or empty fallback) #64552
Fix TypeScript errors in createTheme for optional tokens support
The API schema for Theme became opaque ({[key: string]: unknown}) after
@model_serializer was added to Theme in Python to exclude None values.
This broke theme.ts in two ways:
Fix by conditionally spreading tokens/globalCss (guarding for CSS-only
themes) and casting to Record<string, unknown> which is assignable to
TokenDefinition. Use conditional mergeConfigs call to avoid passing
undefined.
The @model_serializer(mode="wrap") on Theme and ThemeColors caused
Pydantic to generate additionalProperties:true for both models in the
OpenAPI spec, losing typed fields (tokens, globalCss, icon) and
breaking TypeScript types to {[key: string]: unknown}.
Fix: remove wrap serializers from Theme/ThemeColors; add
@field_serializer("theme") to ConfigResponse with model_dump(exclude_none=True)
to preserve None-exclusion behavior scoped to the theme field only.
Add ConfigDict(json_schema_mode_override="validation") to ConfigResponse
so schema generation uses type annotations rather than the field
serializer's dict return type, keeping the $ref: Theme link intact.
Also removes unrelated .worktrees/ entry from .gitignore.
(cherry picked from commit a06896f)
Co-authored-by: Constance Martineau constance.alyssa.martineau@gmail.com