Commit Graph
1803 Commits
Author SHA1 Message Date
Giulio Canti 9ef4675b3f handle ParseOptions.propertyOrder (#180) 2025-06-26 18:17:34 +02:00
Giulio Canti 11b97ad753 update tstyche (#179)
* Enhance documentation for flipping schemas

* update tstyche

* refactor model docs
2025-06-26 15:12:53 +02:00
Giulio Canti a84732ff5b handle unexpected keys (#176)
* handle unexpected keys

* docs

* try to reduce bundle (#177)

* remove Option from UnexpectedKey issue
2025-06-26 08:20:06 +02:00
Giulio Canti 577d3d3a5b fix code snippet (#174) 2025-06-25 18:39:25 +02:00
Giulio Canti c87fc277f5 Default JSON Serialization / Deserialization (#173) 2025-06-25 18:12:12 +02:00
Giulio Canti 30f02fdff7 chore: improve json schema generation (#172)
* add isOptional helper

* improve json schema generation

* remove unused function
2025-06-25 16:24:15 +02:00
Giulio Canti b0674038ba add Introduction (#171) 2025-06-24 19:38:33 +02:00
Giulio Canti 5b31719546 Message system (#169)
* refactor formatters

* fix docgen

* remove message field from Structured formatter

* Enhance candidate type retrieval

* use SchemaIssue.AnyOf
2025-06-24 16:32:08 +02:00
Giulio Canti b025ea9c86 Record: properly handle literal keys (#170)
* add new bundle as a baseline

* properly handle literal keys

* add type-level tests
2025-06-24 16:31:32 +02:00
Michael Arnaldi d086c50784 unify provide service and make provide (#168)
* unify provide service and make provide

* compact impl
2025-06-24 12:17:30 +02:00
Giulio Canti ecc0ba8828 move abort from return type to Filter (#167) 2025-06-23 08:30:14 +02:00
Giulio Canti 931ccb87d5 remove ast parameter from SchemaGetter / SchemaMiddleware (#166) 2025-06-22 16:18:33 +02:00
Giulio Canti fa3735bad3 simplify Tree formatter messages (#165)
* simplify Tree formatter

* add transformation / middleware context

* simplify Tree formatter messages

* chore

* chore
2025-06-22 15:54:03 +02:00
Giulio Canti 7e9142ff34 fix identifier annotation handling (#164)
* improve message system

* refactor Filter signature

* add typeCodecLambda / encodedCodecLambda lambdas

* fix decodeUnknownResult signature

* handle message annotation in InvalidType

* latest zod

* rename formatters

* i18next examples

* Message as function

* fix None value management

* simplify

* shorten default messages

* fix structured formatter bug

* remove useless field

* add AnyOf issue

* remove annotations from Pointer issue

* refactor formatters

* formatSystemMessage

* docs

* add annotations parameters to all checks

* fix identifier annotation
2025-06-21 16:38:06 +02:00
Giulio Canti bfcdbadfb2 rename derive (#163)
* Literals.mapMembers

* Struct.mapFields

* Tuple.mapElements

* Union.mapMembers

* add test helper
2025-06-18 07:36:00 +02:00
Giulio Canti aca4cabb28 rename map to derive (#162) 2025-06-17 17:38:52 +02:00
Giulio Canti 4fcf3be2df Add validation to ensure literals are finite numbers in LiteralType (#161) 2025-06-17 07:47:55 +02:00
Giulio Canti d26de26a2a Fields / Elements / Members Mapping (#160)
* refactor Struct

* add evolveKeys

* add evolveEntries

* docs

* add struct lambda

* implement map / mapPick

* docs

* improve AST formatting

* add Tuple.map

* add Union.map

* add Literals.map & docs

* fix example

* add tuple pick / omit

* test opaque structs

* add Struct.mapOmit, Tuple.mapPick, Tuple.mapOmit

* add Apply type-level helper

* remove code duplications

* chore

* add renameKeys

* add renameIndices

* simplify EntryEvolved

* add Schema.encodeKeys
2025-06-16 16:38:52 +02:00
Giulio Canti 8ee0074eda add pretty generation (#159)
* add pretty generation

* add bundle

* chore

* chore
2025-06-10 18:33:43 +02:00
Giulio Canti ce3645a47f handle __proto__ own key in do notation (#158) 2025-06-10 16:25:29 +02:00
Giulio Canti eda4bb5004 add equivalence generation (#157)
* add equivalence generation

* apply new naming convention

* add override annotation helper

* fix "__proto__" own key management

* add bundle
2025-06-10 10:40:38 +02:00
Giulio Canti 1e4acaa571 Implement getAnnotation function to retrieve JSON schema annotations from AST (#156) 2025-06-09 16:07:19 +02:00
Giulio Canti 75a1df79e7 renaming: align mutability to optionality (#155)
* rename isReadonly to isMutable

* rename OptionalToken, ReadonlyToken, and DefaultConstructorToken to Optionality, Mutability, and ConstructorDefault
2025-06-09 09:37:14 +02:00
Giulio Canti e4151b7543 add arbitrary generation (#151)
* add arbitrary generation

* improve SchemaToJsonSchema

* add bundle

* makeLazy

* add Context

* more recursive tests

* fix annotations

* add filter management

* add tuple checks

* add struct checks

* try to reduce bundle

* add @rollup/plugin-replace for environment variable handling and update error messages in SchemaAST

* fix structWithRest check

* fix index signatures parsing

* simplify stringMatching algo

* fix is / asserts

* more tests

* date checks

* bigint checks

* fix context passing

* docs

* use reset context
2025-06-09 08:08:31 +02:00
Michael ArnaldiandGiulio Canti 6258206a71 test immer without dependency (#148)
* test immer without dependency

* add equality tests

* make classes immerable by default

* remove workaround

* remove duplicated test

---------

Co-authored-by: Giulio Canti <giulio.canti@gmail.com>
2025-06-08 07:26:47 +02:00
Michael Arnaldi fb462d84c8 Avoid using defineProperty in hash for compatibility with frozen objects (#154) 2025-06-07 11:33:08 +02:00
Tim b0c0493140 improve batch grouping (#153) 2025-06-06 15:34:26 +12:00
Tim c6eb09e6cf propagate context in Effect.addFinalizer (#152) 2025-06-06 15:00:08 +12:00
Giulio Canti 53d8b52851 json schema generation (#150)
* json schema generation

* tuples

* object

* more tests

* add bundle

* handle documentation annotation
2025-06-05 16:55:38 +02:00
Giulio Canti 48cdb3be47 add test for immer compatibility (#147) 2025-06-03 17:02:49 +02:00
Giulio Canti a017ecd217 Add NonEmptyArray schema support (#146) 2025-06-03 16:34:03 +02:00
Giulio Canti 49e24417a3 Add size checks to SchemaCheck (#145) 2025-06-03 12:27:48 +02:00
Giulio Canti f939c6de83 add support for structural filters (#144)
* better default error messages

* use symbol in isSchema

* add support for structural filters

* chore

* add minEntries / maxEntries
2025-06-03 12:07:42 +02:00
Giulio Canti fdb8d96bc3 fix contextual make (#143)
* fix contextual make

* fix other APIs + more tests

* update tstyche

* docs

* add Opaque test
2025-06-03 08:41:58 +02:00
Giulio Canti 22c05c7d3e add check method (#142)
* add check method

* update docs
2025-05-31 17:42:01 +02:00
Giulio Canti 4860a66b0d Add key annotations support (#141)
- Introduced `Schema.annotateKey` for annotating keys and elements in schemas.
- Updated `SchemaAST` and `SchemaIssue` to handle annotations in error reporting.
- Enhanced `SchemaFormatter` to display annotations in error messages.
- Added tests for key annotations in both Struct and Tuple schemas.
2025-05-31 16:43:50 +02:00
Giulio Canti 64247af171 Add standard schema support (#140)
* Update fast-check to version 4.1.1 and add new decoding/encoding promise APIs in Schema module

* add standard schema

* return a schema from standardSchemaV1
2025-05-31 15:11:37 +02:00
Giulio Canti 2ea49170ae fix make (#139) 2025-05-31 08:50:35 +02:00
Giulio Canti e23e273c47 Refactor index signatures (#138)
* rename to Record

* handle record mutability

* replace StructWithRest with withRecord API

* more tests

* renaming

* handle post rest elements

* chore

* StructWithRest + TupleWithRest

* rename ReadonlyTuple to Tuple

* rename ReadonlyArray to Array

* docs

* fix mutability model
2025-05-30 16:22:11 +02:00
Giulio Canti a5f1560845 Simplify template literals impl (#137)
* Rename StructAndRest to StructWithRest

* add bundle to check current size

* simplify impl

* remove boolean

* add support for BigInt

* should use the encoded sides

* Refactor TemplateLiteral to expose parts

* add support for filters

* remove internal getTemplateLiteralRegExp

* add checks to format

* better transformation support

* add TemplateLiteralParser

* hide impl details

* docs
2025-05-29 09:01:32 +02:00
Giulio Canti 65a4564f66 add is / asserts (#136) 2025-05-27 16:33:07 +02:00
Giulio Canti 3bac0de276 unify filters, refinements, brands (#135)
* unify filters, refinements, brands

* refactoring

* add brand to filter annotations
2025-05-27 15:28:35 +02:00
Giulio Canti 5a12828f51 refactor checkEffect as transformation (#134)
* should be possible to define a class with a mutable field

* docs: recursive patterns

* chore

* remove make API interface

* more TemplateLiteral tests

* add NoInfer

* add missing "~rebuild.out"

* chore

* refactor checkEffect as transformation

* chore

* add example
2025-05-26 15:25:25 +02:00
Giulio Canti 6029e7c360 simplify flip (#133) 2025-05-24 18:21:41 +02:00
Giulio Canti 7cc2ad3e8a add missing SchemaToParser APIs (#132)
* add missing SchemaToParser APIs

* chore

* uniform bundles

* fix benchmarks
2025-05-24 17:13:25 +02:00
Giulio Canti 0454f8ae3a refactor refine and brand (#131)
* remove checkEncoded

* refactor refine and brand
2025-05-23 15:04:56 +02:00
Giulio Canti ebb3f8d47e add decode / encode APIs + renaming (#130)
* add decode / encode APIs + renaming

* fix bundle

* all transformation as functions

* rename SchemaParser to SchemaToParser

* fix

* remove useless transformations

* fix bundles

* enhance decodeTo / encodeTo to act as composition operators
2025-05-22 17:02:16 +02:00
Giulio Canti 84045cb8a2 add mutable (#129)
* flip doc + type level tests

* add mutable Array

* Enhance withConstructorDefault to accept input parameter and update tests to validate behavior

* add mutable
2025-05-21 19:35:07 +02:00
Giulio Canti 78336988e5 Schema changes (#128)
* simplify makeSync failure message

* brands as Set

* Result.transposeMapOption from v3

* functions

* tmp

* fix constructorDefault signature

* update major version

* refactor signatures

* remove useless annotations

* fix encodedCodec API interface

* refactor Context

* remove SchemaAnnotations.Annotable

* remove EncodedFromKey

* fix suspend Api interface

* remove ~encoded.make.in

* make MakeIn type parameter optional

* fix flip API interface
2025-05-21 16:35:49 +02:00
Giulio Canti 94167dbd0b more on optional fields (#127)
* more on optional fields

* renaming

* fix optionalKey and mutableKey

* docs

* chore

* refactor SchemaGetter

* simplify code

* refactor issues and SchemaGetter

* update docs

* simplify
2025-05-19 14:55:33 +02:00