Skip to content

[v3-2-test] Allow UI theme config without tokens (CSS-only or empty fallback) (#64552)#64852

Merged
bbovenzi merged 1 commit intov3-2-testfrom
backport-a06896f-v3-2-test
Apr 7, 2026
Merged

[v3-2-test] Allow UI theme config without tokens (CSS-only or empty fallback) (#64552)#64852
bbovenzi merged 1 commit intov3-2-testfrom
backport-a06896f-v3-2-test

Conversation

@github-actions
Copy link
Copy Markdown

@github-actions github-actions bot commented Apr 7, 2026

  • 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:

  • 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

…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>
@bbovenzi bbovenzi merged commit d736ea7 into v3-2-test Apr 7, 2026
108 checks passed
@bbovenzi bbovenzi deleted the backport-a06896f-v3-2-test branch April 7, 2026 17:51
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API area:UI Related to UI/UX. For Frontend Developers. kind:documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants