Skip to content

Conversation

@WendellXY
Copy link
Owner

This pull request refactors the option set types used by the CodableKit package, centralizing their definitions in a new CodableKitCore target. It replaces local implementations and compatibility shims in both runtime and macro code with imports and typealiases pointing to the canonical definitions in CodableKitCore. The package manifest is updated to add the new core target and wire up dependencies.

Core library refactor and centralization:

  • Added new target CodableKitCore to the package manifest, and updated CodableKit and CodableKitMacros targets to depend on it. (Package.swift) [1] [2]
  • Moved canonical definitions of CodableKeyOptions and CodableOptions to Sources/CodableKitCore/CodableKeyOptions.swift and Sources/CodableKitCore/CodableOptions.swift, respectively. [1] [2]

Runtime code changes:

  • Replaced the local definitions of CodableKeyOptions and CodableOptions in Sources/CodableKit with typealiases to their core equivalents, and imported CodableKitCore where needed. [1] [2] [3]

Macro implementation changes:

  • Removed local implementations of CodableKeyOptions and CodableOptions in Sources/CodableKitMacros, replacing them with imports from CodableKitCore. (Sources/CodableKitMacros/CodableKeyOptions.swift, Sources/CodableKitMacros/CodableOptions.swift) [1] [2]
  • Updated macro source files to import CodableKitCore for option set usage. (Sources/CodableKitMacros/CodableMacro.swift, Sources/CodableKitMacros/CodeGenCore.swift) [1] [2]

This refactor ensures that option set definitions are consistent and shared between runtime and macro code, improving maintainability and reducing duplication.

@WendellXY WendellXY added this to the v2 milestone Dec 31, 2025
@WendellXY WendellXY self-assigned this Dec 31, 2025
Copilot AI review requested due to automatic review settings December 31, 2025 08:35
Copy link
Contributor

Copilot AI left a comment

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 refactors the CodableKit package architecture by extracting shared option set definitions into a new CodableKitCore target, eliminating code duplication between runtime and macro implementations. The refactoring ensures consistency of option definitions across both contexts while maintaining backward compatibility through typealiases.

Key changes:

  • Created new CodableKitCore target containing canonical definitions of CodableKeyOptions and CodableOptions
  • Updated package dependencies to establish proper target relationships
  • Replaced local implementations in both runtime and macro code with imports and typealiases

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Package.swift Adds CodableKitCore target and wires up dependencies for CodableKit and CodableKitMacros
Sources/CodableKitCore/CodableOptions.swift New file containing canonical public definition of CodableOptions with documentation
Sources/CodableKitCore/CodableKeyOptions.swift New file containing canonical public definition of CodableKeyOptions with documentation
Sources/CodableKit/CodableOptions.swift Replaced struct definition with typealias to CodableKitCore.CodableOptions
Sources/CodableKit/CodableKeyOptions.swift Replaced struct definition with typealias to CodableKitCore.CodableKeyOptions
Sources/CodableKit/CodableKit.swift Added import for CodableKitCore
Sources/CodableKitMacros/CodableOptions.swift Removed local struct definition, added import of CodableKitCore
Sources/CodableKitMacros/CodableKeyOptions.swift Removed local struct definition, added import of CodableKitCore
Sources/CodableKitMacros/CodeGenCore.swift Added import for CodableKitCore
Sources/CodableKitMacros/CodableMacro.swift Added import for CodableKitCore

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

public static let skipProtocolConformance = Self(rawValue: 1 << 1)
}


Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

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

Unnecessary trailing blank line at the end of the file. This should be removed to maintain consistency with code style conventions.

Copilot uses AI. Check for mistakes.
Comment on lines 49 to 50


Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

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

Unnecessary trailing blank line at the end of the file. This should be removed to maintain consistency with code style conventions.

Suggested change

Copilot uses AI. Check for mistakes.
@WendellXY WendellXY merged commit 407f2f3 into main Dec 31, 2025
7 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