Giulio Canti

Results 398 comments of Giulio Canti

Why you would do that though? ```ts import * as S from "@effect/schema/Schema" import * as JSONSchema from "@effect/schema/JSONSchema" console.log(JSON.stringify(JSONSchema.to(S.string.pipe(S.jsonSchema({ type: "number" }))), null, 2)) /* { "$schema": "http://json-schema.org/draft-07/schema#", "type":...

> I mean you can also construct something like S.string.pipe(S.filter((i) => typeof i === "number")) Yeah, exactly, and in that case you can add a json schema annotation as I...

> Another use case I have for overrides... That's a valid scenario, thanks for the feedback. > Also I think it is transparent and easy to reason about (Sh** in...

Ok I took a look at the code and I have encountered a few uncertainties. I propose dividing the problem into two distinct parts: 1) (current state) add documentation and...

This is intentional: `a` is optional therefore `{}` is a legal value (and is returned as an ok result). You may want to add a default to `a` as well:...

Update: now that we have constructors (`make`) the simplest solution is setting the default using them: ```ts import { Schema as S } from "@effect/schema" const Foo = S.Struct({ a:...

@huypham50 `originalSchema` will be a `Schema`, AFAIK there's no way to get back the type of the orginal schema

I mean, even if you managed to define `deserialize`, what use do you make of the returned schema if it is typed as `Schema`?

@FedericoBiccheddu `string` is already a disjoint union with respect to non empty strings: `string = "" + NonEmptyString`, what's the benefit of transforming into `Option`?

The sandbox shows how `optionFromEmptyString` works, however I still don't get: 1) in the transformation why the `To` schema is `Schema.optionFromSelf(Schema.string)` instead of `Schema.optionFromSelf(Schema.string.pipe(Schema.nonEmpty()))`? Is it intended? 2) assuming `To...