-
-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Schema annotations interfaces have been refactored into a namespace Annotations
#2289
Conversation
|
Name | Type |
---|---|
@effect/schema | Minor |
@effect/cli | Major |
@effect/experimental | Major |
@effect/platform-browser | Major |
@effect/platform-bun | Major |
@effect/platform-node-shared | Major |
@effect/platform-node | Major |
@effect/platform | Major |
@effect/rpc-http | Major |
@effect/rpc | Major |
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
b151795
to
5c8b7d7
Compare
I suppose i'm early to the party but the problem I have with this is const Person = S.struct({
name: S.string,
age: S.optional(S.number.pipe(S.positive()), { default: () => 0 }).annotations({
encodedAnnotations: { description: "An optional age." }
})
})
console.log(JSONSchema.make(S.encodedSchema(Person)))
console.log(JSONSchema.make(Person)) we're loosing the interesting information like exclusiveMinimum:
I think JSONSchema has to be about how to get from the Encoded side to the Type side, they are maybe distinct but also related. The Type rules must match to successfully decode. So it's a combination of Encoded side property descriptors, and Type side schema rules. The description "An optional age", makes for a distraction. It's a positive number, it's optionality is a property of the property and documented via the |
yeah, this was more of an attempt focused solely on annotations, but in fact, I don't think it's worth it |
Annotations
No description provided.