Skip to content

Add readable JSON and binary helpers to generated enums - #1

Merged
happyDemon merged 1 commit into
mainfrom
serialization-formats
Nov 9, 2026
Merged

happyDemon merged 1 commit into
mainfrom
serialization-formats

Conversation

@happyDemon

Copy link
Copy Markdown
Member

Generated enums gain:

public function toReadableJson(): string
public function toBytes(): string
public static function fromBytes(string $bytes): self

backed by the runtime's ReadableJson and BinaryFormat. There's no fromReadableJson(): fromDenseJson() already accepts readable input.

BinaryFormat and ReadableJson are reserved import names per record file, so a schema record with either name aliases the runtime class instead of failing generation.

Bumps the version to 0.2.0. Generated code needs php-skir/runtime ^0.2 (php-skir/runtime#2).

Release order: merge php-skir/runtime#2 → merge this → publish a 0.2.0 release (npm) → the three generator PRs go green.

Generated enums now expose toReadableJson(), toBytes() and fromBytes() next to the dense JSON helpers, backed by Skir\Runtime\ReadableJson and Skir\Runtime\BinaryFormat. Both runtime classes are preplanned for every record file so generated records with the same basename are aliased safely. Bumps the package to 0.2.0.
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