Skip to content

Expose serialization initializers#16

Open
Trickfest wants to merge 1 commit into
aperechnev:masterfrom
Trickfest:fix/public-serialization-inits
Open

Expose serialization initializers#16
Trickfest wants to merge 1 commit into
aperechnev:masterfrom
Trickfest:fix/public-serialization-inits

Conversation

@Trickfest

Copy link
Copy Markdown

Summary

This PR adds explicit public initializers for FenSerialization and SanSerialization.

ChessKit 2.0 removed the previous .default serializer accessors, and the README now shows direct construction with FenSerialization(). Since these are public classes without explicit public initializers, Swift synthesizes internal init() methods, which means downstream packages cannot currently instantiate them.

I stumbled on this while trying to update ChessboardKit to use ChessKit 2.0. It needs to deserialize FEN into a Game(position:) and serialize the current position back to FEN, but FenSerialization() was not accessible from outside the module.

Nice job on ChessKit, btw! :-)

Changes

  • Added public init() {} to FenSerialization
  • Added public init() {} to SanSerialization
  • Added a small public API test that imports ChessKit normally and verifies both serializers can be constructed by downstream users

This does not reintroduce .default and does not change serialization behavior.

Verification

  • swift test

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.

1 participant