Add options to Schema.fromJsonString - #6707
Conversation
🦋 Changeset detectedLatest commit: 5c3420a The changes in this PR will be included in the next version bump. This PR includes changesets to release 29 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (4)
📝 WalkthroughWalkthrough
ChangesJSON string schema configuration
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Caller
participant SchemaFromJsonString
participant SchemaTransformationFromJsonString
participant SchemaGetter
Caller->>SchemaFromJsonString: provide schema and JSON options
SchemaFromJsonString->>SchemaTransformationFromJsonString: create configured transformation
SchemaTransformationFromJsonString->>SchemaGetter: configure parseJson and stringifyJson
SchemaGetter-->>Caller: decode or encode JSON string
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
Comment |
Bundle Size Analysis
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/effect/src/SchemaTransformation.ts`:
- Around line 1621-1623: The JSON option types currently infer only the array
replacer overload. Define a shared replacer type that includes both callback and
array forms, then reuse it for the replacer fields in SchemaTransformation,
Schema, and the corresponding SchemaGetter options; leave reviver and space
typing unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 2491bca9-e8d8-4cbc-8a36-149150708f35
📒 Files selected for processing (6)
.changeset/internal-json-string-schema.mdpackages/effect/src/Schema.tspackages/effect/src/SchemaTransformation.tspackages/effect/src/unstable/http/UrlParams.tspackages/effect/test/schema/Schema.test.tspackages/tools/api-diff/src/Json.ts
Summary by CodeRabbit
Schema.fromJsonString.reviver,replacer, andspaceoptions for transformation and pretty-printed output.Schema.fromJsonString(Schema.Unknown).JsonReplacertype forstringifyJsonconfiguration.reviver,replacer, andspacebehavior.