Skip to content

Schema: add optional #193

@nikgraf

Description

@nikgraf

How should it looks like?

Proposal 1

Default is required for type-safety. This is also the TypeScript and Effect default.

name: Type.optional(Type.Text),

This is also maps exactly to what Effect does: https://effect.website/docs/schema/advanced-usage/#basic-optional-property

All optional version for debugging

Sometimes this is super useful. Deriving a form from it where validation only happens at the end. We could have utility that does that e.g. const EventOptional = makeAllFieldsOptional(Event)

Implementation Notes

this need a change for all the field[key] === Entity.Date checks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions