github-actions[bot] opened a new pull request, #64852:
URL: https://github.com/apache/airflow/pull/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 a06896fe1de2213b5c1c2d07c8310f4a85ea507c)
Co-authored-by: Constance Martineau <[email protected]>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]