Skip to content

feat(settings): improve JSON schema for frontend form rendering#1353

Open
hiitsrob wants to merge 1 commit intorivenmedia:mainfrom
hiitsrob:settings-schema
Open

feat(settings): improve JSON schema for frontend form rendering#1353
hiitsrob wants to merge 1 commit intorivenmedia:mainfrom
hiitsrob:settings-schema

Conversation

@hiitsrob
Copy link
Copy Markdown

@hiitsrob hiitsrob commented Jan 18, 2026

Pull Request Check List

Resolves: #1352

  • Added tests for changed code.
  • Updated documentation for changed code.

Description:

  • Add human-readable titles to all model classes via ConfigDict
    • Debrid: Real-Debrid, Debrid-Link, AllDebrid, Downloaders
    • Media Servers: Plex, Jellyfin, Emby, Media Servers (container)
    • Content: Overseerr, Plex Watchlist, Listrr, MDBList, Trakt, Content Sources
    • Scrapers: Torrentio, Comet, Zilean, MediaFusion, Orionoid, Jackett, Prowlarr, RARBG, AIOStreams, Scraping (container)
    • Other: Filesystem, Database, Indexer, Notifications, Post Processing, Logging, Streaming, Filter Rules, Library Profile, Subtitles
  • Add format: password to all API keys, tokens, and secrets for automatic input masking in UI
  • Add ItemType enum for NotificationsModel.on_item_type to generate enum constraint in schema (enables checkbox multi-select in UI)
  • Fix /schema/keys endpoint to preserve field metadata (title, description, format, etc.) by using pydantic.create_model instead of TypeAdapter

These changes allow the frontend settings forms to be fully schema-driven without hardcoded display name mappings.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added expanded downloader configuration options with additional proxy and authentication settings.
    • Enhanced notification filtering with improved type categorization.
  • Improvements

    • API keys and authentication tokens now display with secure password masking.
    • Improved settings schema with clearer labels and better section organization for easier configuration management.
    • Strengthened validation logic for configuration fields.

✏️ Tip: You can customize this high-level summary in your review settings.

  - Add human-readable titles to all model classes via ConfigDict
    - Debrid: Real-Debrid, Debrid-Link, AllDebrid, Downloaders
    - Media Servers: Plex, Jellyfin, Emby, Media Servers (container)
    - Content: Overseerr, Plex Watchlist, Listrr, MDBList, Trakt, Content Sources
    - Scrapers: Torrentio, Comet, Zilean, MediaFusion, Orionoid, Jackett,
      Prowlarr, RARBG, AIOStreams, Scraping (container)
    - Other: Filesystem, Database, Indexer, Notifications, Post Processing,
      Logging, Streaming, Filter Rules, Library Profile, Subtitles
  - Add format: password to all API keys, tokens, and secrets for
    automatic input masking in UI
  - Add ItemType enum for NotificationsModel.on_item_type to generate
    enum constraint in schema (enables checkbox multi-select in UI)
  - Fix /schema/keys endpoint to preserve field metadata (title, description,
    format, etc.) by using pydantic.create_model instead of TypeAdapter

  These changes allow the frontend settings forms to be fully
  schema-driven without hardcoded display name mappings.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jan 18, 2026

Walkthrough

This pull request adds configuration metadata to settings models and refactors schema generation. It introduces an ItemType enum for notifications, adds human-readable titles via ConfigDict to 30+ models, marks sensitive fields with password formatting in the JSON schema, expands DownloadersModel with debrid service configurations, and replaces manual schema construction with Pydantic's create_model for better metadata preservation in the /schema/keys endpoint.

Changes

Cohort / File(s) Summary
Model Configuration Metadata
src/program/settings/models.py
Added ConfigDict(title="...") to 30+ public model classes (RealDebridModel, PlexLibraryModel, UpdatersModel, NotificationsModel, etc.) for improved schema labeling in generated documentation and frontend UI.
Sensitive Field Protection
src/program/settings/models.py
Added json_schema_extra={"format": "password"} to API keys, tokens, and secrets across RealDebridModel, PlexLibraryModel, JellyfinLibraryModel, TraktOauthModel, JackettConfig, and others for frontend masking.
ItemType Enum Introduction
src/program/settings/models.py
Introduced ItemType enum with values (movie, show, season, episode) and updated NotificationsModel.on_item_type from list[str] to list[ItemType] for type safety and constrained schema validation.
DownloadersModel Expansion
src/program/settings/models.py
Added proxy_url field and nested RealDebridModel, DebridLinkModel, AllDebridModel configurations to support multi-service downloader management.
Library & Logging Enhancements
src/program/settings/models.py
Added migration logic to LibraryProfileFilterRules for exclude_genres migration; enhanced LoggingModel with retention_hours, rotation_mb, compression fields; refined AppModel.check_debug to use identity checks (is) instead of equality (==).
Schema Generation Refactoring
src/routers/secure/settings.py
Replaced TypeAdapter-based manual schema construction with dynamic Pydantic create_model approach in schema-for-keys endpoint to preserve full field metadata (title, description, format, defaults) for lazy-loaded settings sections.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

backend

Suggested reviewers

  • joemckie

Poem

🐰 Enum friends and titles bright,
Passwords masked from mortal sight,
Schema fields now complete and true,
Debrid services added too,
Settings forms shine anew! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the primary change: improving JSON schema for frontend form rendering by adding titles, password formats, and field metadata.
Description check ✅ Passed The description provides clear context with specific changes and resolutions issue #1352, though test and documentation checkboxes remain unchecked.
Linked Issues check ✅ Passed All four primary objectives from issue #1352 are met: ConfigDict titles added to models, password format added to sensitive fields, ItemType enum introduced for notifications, and /schema/keys endpoint fixed to preserve field metadata.
Out of Scope Changes check ✅ Passed All changes are directly scoped to issue #1352 objectives. Model configurations, password formatting, enum typing, and endpoint fixes align with stated requirements.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@hiitsrob
Copy link
Copy Markdown
Author

The docstring coverage failed check seems out of scope of this PR. I think it might be including generated code. @dreulavelle do you know if there's a way to configure this? I don't want to start adding docstrings just for the sake of getting the check to pass.

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.

[Issue] Settings JSON schema missing titles, password format, and field metadata in /schema/keys endpoint

1 participant