Repository navigation
Add readable JSON and binary helpers to generated structs - #2
Merged
Merged
Conversation
Generated structs now expose toReadableJson(), toBytes() and fromBytes() next to the dense JSON helpers. fromBytes() hydrates through fromArray(), like fromDenseJson(). Requires @php-skir/generator-core ^0.2.0, which adds the same helpers to generated enums.
Locks @php-skir/generator-core 0.2.0 from the registry.
happyDemon
force-pushed
the
serialization-formats
branch
from
November 9, 2026 11:48
971d591 to
5d8e9b0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Generated structs gain
toReadableJson(),toBytes()andfromBytes(), placed after the existing dense JSON methods.fromBytes()hydrates through the same path as the existing dense "from" method, so validation still applies where the generator validates. There's nofromReadableJson(): the existing dense "from" method already accepts readable JSON.Enums get the same methods from
@php-skir/generator-core0.2.0 (dependency bumped to^0.2.0). Integration tests round-trip structs and enums through bytes and check readable output against the runtime.CI is red until php-skir/runtime#2 is merged and
@php-skir/generator-core0.2.0 is published (php-skir/generator-core#1). The lockfile references 0.2.0 without an integrity hash because it isn't published yet. Runnpm installonce after publishing to fill it in.