Repository navigation
refactor: every JSON encoding is its format's Effect Schema - #93
Open
systemfsoftware-bot wants to merge 9 commits into
Open
systemfsoftware-bot wants to merge 9 commits into
systemfsoftware-bot wants to merge 9 commits into
Conversation
ryanleecode
force-pushed
the
refactor/codecs
branch
from
November 29, 2026 06:32
3405b31 to
301e21c
Compare
…gh its own schema Every JSON text is Schema.fromJsonString over the format's schema. The shared wrapper, the key-sorting replacer, canonicalKey and the Json namespace are deleted. Structural keys for types, signatures and items encode through their own schemas. The verdict writer encodes from Schema.toEncoded(Verdict), because the cell hands it the encoded verdict. The scenario asserting the removed trailing newline is deleted.
…owed insertion order
This branch has not been deployed
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.
Deletes every hand-written JSON writer and reader. Each format's text is
Schema.fromJsonStringover its own schema. There is no shared canonical-JSON module, key sorter orJsonnamespace.ApiModelFromJsonText,RuleCorpusFromJsonText,VerdictFromJsonText,PackageManifestFromJsonTextandExportTargetFromPackageExportsare the readers and writers of their formats.ApiModel.decode/encodeandVerdict.decodeRuleCorpusare removed.typeExprKey,signatureKey,itemKey).Schema.toEncoded(Verdict), because the cell hands it the encoded verdict.formatDocModel,formatTsdocMetadataand the verdict writer return typed failures instead of throwing.inlineSchemaTests()from@systemfsoftware/effect-schema-vite.src/schema-laws.test.tsis the committed stub, and the plugin generates the round-trip and recursion laws for every exported schema.Output change: JSON keys follow schema declaration order and the text has no trailing newline. Decoding accepts any key order, and
API_MODEL_SCHEMA_VERSIONis unchanged. The scenario asserting the trailing newline is deleted (it covered removed behaviour).Follow-ups: the doc model and tsdoc metadata still build untyped JSON, and
sortModelruns before encode rather than inside it. Each moves to a declared schema in its own PR.Checks: install, typecheck, lint and build exit 0. Each test file in packages/api-extractor passes when run on its own, and so do the e2e app's two integration files.