Skip to content

feat: add json schema for config files - #18

Merged
troycdc merged 2 commits into
mainfrom
feat/json-schema
Apr 30, 2026
Merged

feat: add json schema for config files#18
troycdc merged 2 commits into
mainfrom
feat/json-schema

Conversation

@troycdc

@troycdc troycdc commented Apr 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add JSON Schema definitions for both config files (config.toml and tui.toml) under schemas/configs/
  • Add github module to cdcx-core with URL builders (html, api, raw, release_download) derived from CARGO_PKG_REPOSITORY, replacing hardcoded GitHub URLs in update.rs
  • Generated config files now include a #:schema directive pointing to the raw GitHub URL, enabling editor validation and autocomplete
  • Reorganize schemas/ directory: API overlays moved to schemas/apis/, config schemas live in schemas/configs/

Schema coverage

File Schema
~/.config/cdcx/config.toml schemas/configs/config.json — profiles with api_key, api_secret, environment
~/.config/cdcx/tui.toml schemas/configs/tui.json — theme, tick rate, ticker speed, watchlist, custom themes with hex color validation

Test plan

  • cargo check passes
  • cargo test -p cdcx-core -- github — 5 new tests for URL builders
  • Run cdcx setup and verify generated config.toml starts with #:schema directive
  • Run TUI setup wizard and verify generated tui.toml starts with #:schema directive
  • Open generated TOML files in an editor with TOML schema support and confirm validation works

@llcro llcro left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice idea - get it merged

@troycdc
troycdc merged commit db51d91 into main Apr 30, 2026
8 checks passed
@troycdc
troycdc deleted the feat/json-schema branch April 30, 2026 02:10
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.

2 participants