fix(deps): update dependency sury to v11.0.0-rc.2 - #2345
Merged
Conversation
renovate
Bot
force-pushed
the
renovate/sury-11.x
branch
4 times, most recently
from
September 4, 2026 21:23
e0d2671 to
4721ecb
Compare
renovate
Bot
force-pushed
the
renovate/sury-11.x
branch
from
September 5, 2026 02:14
4721ecb to
cc9ec99
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.
This PR contains the following updates:
11.0.0-alpha.10→11.0.0-rc.2Release Notes
DZakh/sury (sury)
v11.0.0-rc.2Compare Source
What's Changed
Polished Custom Codecs
When no built-in conversion fits, pass your own
decodeandencode:Unlike the previous versions, the result of
decodeis validated by the target schema, so a coder thatreturns the wrong thing fails right there instead of leaking a bad value.
Besides a function, each direction accepts:
Describe what you decode into. The target is what validates the coder's result,
types the output, and exports to JSON Schema:
ReScript
ReScript conversions also changed in the same direction, but with a few differences.
New
S.anyschemaS.tonow accepts an optional~customcodecs objectEach direction is one of:
S.transformis removed in favor ofS.towith an explicit target. UseS.anyto match previous behavior:Other Changes
Full Changelog: DZakh/sury@v11.0.0-rc.1...v11.0.0-rc.2
v11.0.0-rc.1Compare Source
Faster, Safer, Broader
S.integer,S.blob,S.file,S.gte,S.maxLength,S.maxSize,S.multipleOf, 14 new string formats and more.S.array(S.schema({ id: S.string }))->S.array({ id: S.string }).console.log("This is " + S.string)//This is Schema<string>Encode faster than
JSON.stringify🚀It compiles to the text itself, not to a value you stringify afterward:
Types
JSON.stringifyrefuses are ordinary fields here. Values it silently corrupts throw instead:JSON.stringifybigintid + binary payload +DateFaster than
JSON.stringify, and 3.5× lighter than fast-json-stringify — 16.2 kB against 56.7 kB, encoder included.From
JSON Schemawith type inference 📄Define your schemas in plain JSON Schema with type inference - no Sury-specific API needed.
Get all powers of Sury - type inference, validation, encoding, decoding, Standard Schema, and more:
New schemas and refinements 🔤
Control divisibility with
.with(S.multipleOf, value)which also powers a new built-inS.integerschema:Full JSON Schema string format vocabulary:
Working with Files or Blobs - no problem:
S.minandS.maxmeant "length" or "bound," depending on what you pass them. They're split:A literal length pins the type:
An expression in error messages got cleaner and more concise:
Inline container schema definitions 🪆
Anywhere a schema is accepted, a raw definition works too. Previously, explicit
S.schemawas required:Works for
S.array,S.record,S.optional,S.nullable,S.nullishandS.compactColumns.schema.toString() 🧹
We added
schema.toString()which returns syntactic representation likeSchema<TInput, TOutput>:Faster around the compiled code ⚡
The compiled operation was never the bottleneck. The call logic around it was:
Sury has lazy compilation and caching logic, so we don't compile operations you don't need, and every
S.parser(schema)call, e.g., in a React component, doesn't compile a new function.In the release, the logic was improved, which resulted in a noticeable performance increase.
ReScript and the PPX 🐫
Recursive types support
Mutually recursive types work too:
@s.with(S.t<'value> => S.t<'value>)Applies to: type declarations, type expressions
Transforms the generated schema with the provided function:
Use
_to pass extra arguments, and repeat the attribute to chain transforms — they apply in order:The transform must return a schema of the same type — changing it (e.g. with
S.to) is a compile-time error.Let's connect 🚀
Contact me on GitHub or X if you have any questions 😁 And enjoy using Sury!
v11.0.0-rc.0Compare Source
Welcome RC.0 🎉
Breaking Changes 💥
union->anyOftag in internal schema representation.New Union Conversion Logic
S.tonow has defined behaviour with a union on either side of the conversion. There are three cases, and anything that doesn't fall cleanly into one of them is rejected where it's written rather than guessed at.Single type → union
Members are tried in the order you wrote them; the first one that accepts the value wins.
The rule that makes this predictable: a value is only converted into a member type the source can't produce itself. JSON has no bigints, so strings are offered to
S.bigint— but JSON already has strings, so theS.stringmember only accepts actual strings. That's whytrueisn't converted to"true"above, even though boolean → string is a supported conversion on its own.Union → single type
The mirror image — each member converts to the target the same way it would with a direct
S.to.Union → union
Values pass through to the member of the same type on the other side. Nothing is converted, so every member needs a counterpart — with one exception: an
undefinedmember without a counterpart may pair with anullmember on the other side, and vice versa.Matching rules
S.int32won't match a plainS.numbermember, andS.jsonwon't matchS.string.S.union([S.string, S.union([S.number, S.boolean])])has three members.When a conversion is rejected
Some conversions have more than one reasonable meaning, and some have none. Rather than guess, Sury rejects those with an
Invalid operationerror at theS.parser/S.encodercall — not later, on each value — and the error names a rewrite that says what you mean.Ambiguous. Given
"123"— should it stay a string, or become a number? Both readings are sensible, so you pick:The two unions don't cover each other. Union-to-union converts nothing, so a member with no same-type counterpart has nowhere to go:
No conversion exists. If a conversion between two types isn't supported outside a union, putting it inside one doesn't change that.
S.nevermarks a member unreachable:Union conversion always validates every member, so transformed unions stay consistent across decode and encode.
Where this is written down
docs/js-usage.md→ Converting to / from a union, and the ReScript mirror indocs/rescript-usage.md. Every sample above is verified against the built library.packages/sury/specs/*.yaml— the behavior above as machine-derived goldens, one per shape.By @DZakh in #317
ReScript PPX
Internal
What's Next?
I plan to polish the new union conversion logic, improve error messages, tree-shaking, JSON Schema compatibility, and add a few more built-in schemas. Ready for a final release after this.
Full Changelog: DZakh/sury@v11.0.0-alpha.11...v11.0.0-rc.0
v11.0.0-alpha.11Compare Source
What's Changed
New Contributors
Full Changelog: DZakh/sury@v11.0.0-alpha.10...v11.0.0-alpha.11
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.