Skip to content

Commit

Permalink
chore: generate docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob-alford committed Nov 9, 2023
1 parent 26e11fa commit d4fc11e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
20 changes: 10 additions & 10 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,26 +130,26 @@ export const PersonSchema = S.Struct({

## Schema Transformations

There are three ways to transform a schema in `schemata-ts`: ['combinators'](#schema) which are functions that take schemas as parameters and return new schemas, 'transformers' which are specific to a particular schema, and `Imap` which applies an invariant transformation to the underlying data-type.
There are three ways to transform a schema in `schemata-ts`: ['combinators'](#schema) which are functions that take schemas as parameters and return new schemas, 'transformers' which are specific to particular schemata, and `Imap` which applies an invariant transformation to the underlying data-type.

### Invariant Transformations

All data-types derivable from schemas are invariant functors, aside from `Guard`. This means that if you supply mapping functions `to`, and `from` the new type, you will adjust the `Output` type of that particular data type. Because `Guard` is not invariant, you must supply the resulting `Guard` to the invariant map. The combinator version of this is `Imap`. In version `3.0` which is coming in late 2023/early 2024 it will be possible to `.imap` a schema.
Aside from `Guard`, all data-types derivable from schemas are invariant functors. This means that supplying mapping functions `to` and `from` to `Imap` adjusts the `Output` of that particular data type. Because `Guard` is not invariant, you must supply the resulting `Guard` to the invariant map. The combinator version of this is `Imap`. In version `3.0` (coming late 2023/early 2024) it will be possible to `.imap()` any schema.

### Schema Transformers

Schema transformers are classes which extend `SchemaImplementation`, and allow adjustment to the underlying schema parameters after it has been declared in an immutable fashion. This is useful for type-specific methods like `pick` or `omit` for `Struct`.

Here are the current transformers and available methods:
Here are the current transformers and available methods,

- `StructSchema`: `pick`, `omit`, `partial`, `partialOption`, `readonly`, `strict`, `addIndexSignature`, `extend`, `intersect`
- `ArraySchema`: `minLength`, `maxLength`, `nonEmpty`
- `StringSchema`: `brand`, `minLength`, `maxLength`, `errorName`
- `IntSchema`: `brand`, `min`, `max`, `errorName`
- `FloatSchema`: `brand`, `min`, `max`, `errorName`
- `TupleSchema`: `append`, `prepend`
- Struct: `pick`, `omit`, `partial`, `partialOption`, `readonly`, `strict`, `addIndexSignature`, `extend`, `intersect`
- Array: `minLength`, `maxLength`, `nonEmpty`
- String: `brand`, `minLength`, `maxLength`, `errorName`
- Int: `brand`, `min`, `max`, `errorName`
- Float: `brand`, `min`, `max`, `errorName`
- Tuple: `append`, `prepend`

... and more to come!
... with more to come!

### Transformation Example

Expand Down
30 changes: 15 additions & 15 deletions docs/schemata/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,23 +85,23 @@ has_children: true

### String (17)

* Ascii ([docs](https://jacob-alford.github.io/schemata-ts/schemata/Ascii.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/Ascii.ts)) (e.g: `:&3Mi]J9`, `>#evxtA}`, `bW|V`)
* Base64 ([docs](https://jacob-alford.github.io/schemata-ts/schemata/Base64.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/Base64.ts)) (e.g: `AlN/g/5++o+8//+AWV+B7f5a`, `A//HSD+xW+==`, `+a+9OE5L`)
* Base64Url ([docs](https://jacob-alford.github.io/schemata-ts/schemata/Base64Url.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/Base64Url.ts)) (e.g: `47QBIX__`, `-O__D1`, `_G7_-8`)
* BitcoinAddress ([docs](https://jacob-alford.github.io/schemata-ts/schemata/BitcoinAddress.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/BitcoinAddress.ts)) (e.g: `bc1acs0y8wunv88bcxpwi02y1bwcux799dly8264td`, `2CaKCMnhRSPMY9qzvLFDn8xD8ok23`, `bc1awz0e1lpa6v2827g6bnxy99re2`)
* Ascii ([docs](https://jacob-alford.github.io/schemata-ts/schemata/Ascii.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/Ascii.ts)) (e.g: `{b;~$D `, `U;o>x2,o`, `sM9n,`)
* Base64 ([docs](https://jacob-alford.github.io/schemata-ts/schemata/Base64.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/Base64.ts)) (e.g: `3/+03/MTc4I++h+7973////5/m+F/vi/+/jSuw==`, `Fve2+i04/+/5`, `+++/1714w/++7/Lv`)
* Base64Url ([docs](https://jacob-alford.github.io/schemata-ts/schemata/Base64Url.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/Base64Url.ts)) (e.g: `Y_ww-6D_`, `s_r_Xy0_sj`, `-AC--y--`)
* BitcoinAddress ([docs](https://jacob-alford.github.io/schemata-ts/schemata/BitcoinAddress.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/BitcoinAddress.ts)) (e.g: `bc1c2dsca37vzb3a312xe47h6n3d2z`, `bc1exbc71d4lb8a88ncyecmb1b857l63dyn`, `2iAUJK4ERBid1CPN6zvQeKQSmGFGd`)
* CamelCaseString ([docs](https://jacob-alford.github.io/schemata-ts/schemata/CamelCaseString.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/CamelCaseString.ts)) (e.g: `Camel_case-string``camelCaseString`)
* CreditCard ([docs](https://jacob-alford.github.io/schemata-ts/schemata/CreditCard.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/CreditCard.ts)) (e.g: `3528587942168942`, `6286620799069453971`, `62873192077181039`)
* EmailAddress ([docs](https://jacob-alford.github.io/schemata-ts/schemata/EmailAddress.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/EmailAddress.ts)) (e.g: `..$'E@[2.047.28.734]`, `"뜽쓸輽寉ꠂ䑁⸱꽠ẻ奅鿌�"@L83-BB.QM05C1j.a-.--W2e.XwvnHvmgC`, `=A!%&.~^~%}?^~~=/.?Lq*%|%@[94.1.73.7]`)
* EthereumAddress ([docs](https://jacob-alford.github.io/schemata-ts/schemata/EthereumAddress.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/EthereumAddress.ts)) (e.g: `0x9EfbBb7ee173F6AcBBACc12b175B6CC9EbF26fd1`, `0xDAe59bA61CeddB33C99e3AEcFA3A0Be0dD62Ce9d`, `0xAa300c1eaf1A8e00ECfdC4BdEBEa8ADcDbBF170C`)
* HexColor ([docs](https://jacob-alford.github.io/schemata-ts/schemata/HexColor.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/HexColor.ts)) (e.g: `aaEADc`, `#03e9af`, `EdC9AE`)
* Hexadecimal ([docs](https://jacob-alford.github.io/schemata-ts/schemata/Hexadecimal.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/Hexadecimal.ts)) (e.g: `0h0cDbbfFB6`, `0h4fFEcf118C`, `FD0ecDf1eAcA`)
* HslColor ([docs](https://jacob-alford.github.io/schemata-ts/schemata/HslColor.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/HslColor.ts)) (e.g: `hsla(.09204772e+2912726610,00000000090e-849471712912%,.02752%)`, `hsla(3551856+0000000000100e241%000000000092%/295378%)`, `hsl(+700.654%+00.461675%/4466051.55%)`)
* Jwt ([docs](https://jacob-alford.github.io/schemata-ts/schemata/Jwt.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/Jwt.ts)) (e.g: `_.ZAf_-Y_-.-T9eY`, `--.__5.c`, `A._-u_b.-Ebj7t-e--`)
* LatLong ([docs](https://jacob-alford.github.io/schemata-ts/schemata/LatLong.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/LatLong.ts)) (e.g: `(-90,180)`, `(2.2544,-180)`, `(90,+180)`)
* NonEmptyString ([docs](https://jacob-alford.github.io/schemata-ts/schemata/NonEmptyString.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/NonEmptyString.ts)) (e.g: `7lengt==`, `pPZL1RdP`, `b1d90d`)
* RGB ([docs](https://jacob-alford.github.io/schemata-ts/schemata/RGB.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/RGB.ts)) (e.g: `rgba(100%,100%,100%,.1)`, `rgba(100%,70%,100%,0.08)`, `rgba(94%,99%,100%,1.0)`)
* CreditCard ([docs](https://jacob-alford.github.io/schemata-ts/schemata/CreditCard.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/CreditCard.ts)) (e.g: `2293037513430698`, `8289225972708943`, `35290351306910219`)
* EmailAddress ([docs](https://jacob-alford.github.io/schemata-ts/schemata/EmailAddress.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/EmailAddress.ts)) (e.g: `"ࠠ䐵濶柃釕"@.-7.K-ha.-a.yesJOqw--m.Jl0-vgp-yz.qbU`, `"伌卉똰傴釋핑￷"@[976.69.06.091]`, `|@-CH7.OdUhVavBrw`)
* EthereumAddress ([docs](https://jacob-alford.github.io/schemata-ts/schemata/EthereumAddress.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/EthereumAddress.ts)) (e.g: `0xa6CbfBfDaB3bfcbB3abCCfBAeFDeD1bb6205fd9C`, `0x00ef0c969FB6fdAb4c1FC6Efcd2dB1ebDf9baeFc`, `0xCAf3BFFdFc3Fe1DDcAcBDa6f7eaAC9EaD9EBA31e`)
* HexColor ([docs](https://jacob-alford.github.io/schemata-ts/schemata/HexColor.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/HexColor.ts)) (e.g: `C0DEcd`, `dC1f45Da`, `7D91CB`)
* Hexadecimal ([docs](https://jacob-alford.github.io/schemata-ts/schemata/Hexadecimal.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/Hexadecimal.ts)) (e.g: `0H3CF0ad`, `B5D8aAfDb`, `2B6ceB`)
* HslColor ([docs](https://jacob-alford.github.io/schemata-ts/schemata/HslColor.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/HslColor.ts)) (e.g: `hsl(662021862513,0000000000.480837%,+000000000100e5%)`, `hsl(98819.9887136e9448688279,000000.0351%,+0100%)`, `hsl(+.5turn+000.4938336%+.5616749%/118716048%)`)
* Jwt ([docs](https://jacob-alford.github.io/schemata-ts/schemata/Jwt.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/Jwt.ts)) (e.g: `33B.8-`, `3l4d.pKS-_k_.-`, `4hP--_.DCW_`)
* LatLong ([docs](https://jacob-alford.github.io/schemata-ts/schemata/LatLong.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/LatLong.ts)) (e.g: `(0,+129)`, `(83.7478188474,-93)`, `90,180.0000`)
* NonEmptyString ([docs](https://jacob-alford.github.io/schemata-ts/schemata/NonEmptyString.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/NonEmptyString.ts)) (e.g: `(%!C0`, `alueEallvalueOf=`, `182967`)
* RGB ([docs](https://jacob-alford.github.io/schemata-ts/schemata/RGB.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/RGB.ts)) (e.g: `rgba(100%,22%,100%,0.184678)`, `rgb(2,209,103)`, `rgba(48%,100%,100%,.26)`)
* String ([docs](https://jacob-alford.github.io/schemata-ts/schemata/String.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/String.ts))
* UUID ([docs](https://jacob-alford.github.io/schemata-ts/schemata/UUID.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/UUID.ts)) (e.g: `2cc0CE8D-6A8d-Cf39-00E2-bBCdc9032AFe`, `13b20Eee-eE98-D0DF-4Adf-A62AFeBfEA9B`, `3Bf72fDc-BAAc-d4DF-E4F0-0E072fbce5f8`)
* UUID ([docs](https://jacob-alford.github.io/schemata-ts/schemata/UUID.html)) ([source](https://github.com/jacob-alford/schemata-ts/tree/main/src/schemata/UUID.ts)) (e.g: `fE9accDB-eeED-d4e0-7EaA-Cda1F0A6b1Ab`, `1F52a15b-FDDa-D3bf-AC0B-Eb89c1cBbaCf`, `82E435EE-be8B-6BCF-5BfE-deB9BE062B8A`)

### Unit (1)

Expand Down

0 comments on commit d4fc11e

Please sign in to comment.