Skip to content

Migrate json configuration files - #110

Merged
cyanzhong merged 1 commit into
mainfrom
develop
Aug 27, 2026
Merged

cyanzhong merged 1 commit into
mainfrom
develop

Conversation

@cyanzhong

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates JSON-based configuration files from a top-level array format to a structured object format that includes a $schema reference and an items array, enabling JSON schema validation while remaining backward-compatible.

Changes:

  • Added ConfigurationFile<T> wrapper (decodes both legacy array JSON and new { "$schema", "items" } JSON) plus a migration helper.
  • Updated Services / KeyBindings / ContentFilters to migrate existing user config files and to decode via ConfigurationFile<T>.
  • Updated bundled Services localization JSON files to the new schema-based object format.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
TextGrabber2/Sources/Services.swift Decode services via ConfigurationFile and attempt on-disk migration when a legacy file already exists.
TextGrabber2/Sources/KeyBindings.swift Write new default config as schema+items object; migrate and decode using ConfigurationFile.
TextGrabber2/Sources/ContentFilters.swift Write new default config as schema+items object; migrate and decode using ConfigurationFile.
TextGrabber2/Sources/ConfigurationFile.swift Introduces schema URL constants, backward-compatible decoding, and a migration routine for legacy array JSON.
TextGrabber2/Resources/Services/en-US.json Converts bundled services config from array to schema+items object.
TextGrabber2/Resources/Services/zh-Hans.json Converts bundled services config from array to schema+items object.
TextGrabber2/Resources/Services/zh-Hant.json Converts bundled services config from array to schema+items object.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread TextGrabber2/Sources/Services.swift
Comment thread TextGrabber2/Sources/KeyBindings.swift
Comment thread TextGrabber2/Sources/ConfigurationFile.swift
Comment thread TextGrabber2/Sources/ContentFilters.swift
@cyanzhong
cyanzhong merged commit e2b666e into main Aug 27, 2026
2 checks passed
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