Skip to content

Commit

Permalink
fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob-alford committed Jul 28, 2023
1 parent cb24f80 commit 6963663
Show file tree
Hide file tree
Showing 15 changed files with 90 additions and 86 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</h1>

<p align="center">
A TypeScript schema engine written with fp-ts and a collection of schemata inspired by io-ts and validators.js.
An all-inclusive schema engine featuring schemata inspired by io-ts and validators.js. Written for TypeScript with fp-ts
</p>

<br><br>
Expand Down Expand Up @@ -179,7 +179,7 @@ or, (De)Serialization from a Base-64 encoded Json String:

```ts
const parsePersonTranscoder: Transcoder<S.Base64, Person> = deriveTranscoder(
S.ParseBase64String(PersonSchema),
S.ParseBase64Json(PersonSchema),
)
```

Expand Down Expand Up @@ -216,12 +216,12 @@ const guardPerson: Guard<Person> = deriveGuard(PersonSchema)

## JSON Schema (Draft 7, 2019-09, and 2020-12)

Json-Schema is a standard for describing JSON data. Schemata-ts can derive Json-Schema from schemas using `deriveJsonSchema` for versions 7, 2019-09, and 2020-12.
Json-Schema is a standard for describing JSON data. Schemata-ts can derive Json-Schema from schemas using `deriveJsonSchema` for versions Draft-07, 2019-09, and 2020-12.

```ts
import { deriveJsonSchema } from 'schemata-ts/JsonSchema'

const personJsonSchema2007 = deriveJsonSchema(PersonSchema, 'Draft-07')
const personJsonSchemaDraft07 = deriveJsonSchema(PersonSchema, 'Draft-07')
const personJsonSchema2019 = deriveJsonSchema(PersonSchema)
const personJsonSchema2020 = deriveJsonSchema(PersonSchema, '2020-12')
```
Expand Down
32 changes: 16 additions & 16 deletions docs/JsonSchema.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Added in v1.2.0
- [nullSchema](#nullschema)
- [number](#number)
- [record](#record)
- [ref](#ref)
- [string](#string)
- [struct](#struct)
- [tuple](#tuple)
Expand All @@ -37,10 +38,9 @@ Added in v1.2.0
- [Model](#model)
- [JsonSchema (type alias)](#jsonschema-type-alias)
- [JsonSchemaValue (type alias)](#jsonschemavalue-type-alias)
- [utils](#utils)
- [URI](#uri)
- [URI](#uri)
- [URI](#uri-1)
- [URI (type alias)](#uri-type-alias)
- [ref](#ref)

---

Expand Down Expand Up @@ -189,6 +189,18 @@ export declare const record: <A>(additionalProperties: Const<JsonSchema, A>) =>
Added in v1.2.0
## ref
A reference to a schema definition
**Signature**
```ts
export declare const ref: <A>(ref: string) => Const<JsonSchema, A>
```
Added in v2.0.0
## string
**Signature**
Expand Down Expand Up @@ -330,7 +342,7 @@ export type JsonSchemaValue =
Added in v1.2.0
# utils
# URI
## URI
Expand All @@ -351,15 +363,3 @@ export type URI = typeof URI
```
Added in v1.2.0
## ref
A reference to a schema definition
**Signature**
```ts
export declare const ref: <A>(ref: string) => Const<JsonSchema, A>
```
Added in v2.0.0
6 changes: 3 additions & 3 deletions docs/TranscodeError.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Added in v2.0.0
## foldMapDepthFirst
Flattens a `DecodeError` tree into a common Monoid with access to the current
Flattens a `DecodeError` tree into a common Semigroup with access to the current
accumulation and current level of depth
**Signature**
Expand All @@ -125,13 +125,13 @@ Draws a tree of `TranscodeErrors` as lines with configurable prefix characters.
The first argument, `prefix` appends any string or character to a concrete node. The
depth represents how many generations are between the root node and the current node.
The total children represents the total number of children the current node has. If a
node has zero children, it is a concrete node; i.e. type-mismatch, unepexted value, or
node has zero children, it is a concrete node; i.e. type-mismatch, unexpected value, or
serialization error. If a node has one or more children, it is a container node; i.e.
error-at-key, error-at-index, or error-at-union-member.
The second argument, `prefixChildren` appends any string or character to a child node,
which would have already been prefixed by the first argument. It will be called for
nodes that have perhapds been prefixed many times.
nodes that have been prefixed many times.
The third argument, `errorStrings` is a configuration object that can be used to
override the default error type templates
Expand Down
3 changes: 0 additions & 3 deletions docs/Transcoder.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ Added in v2.0.0
- [Transcoder (interface)](#transcoder-interface)
- [URI](#uri)
- [URI](#uri-1)
- [utils](#utils)
- [URI (type alias)](#uri-type-alias)

---
Expand Down Expand Up @@ -241,8 +240,6 @@ export declare const URI: 'schemata-ts/Transcoder'
Added in v2.0.0
# utils
## URI (type alias)
**Signature**
Expand Down
6 changes: 3 additions & 3 deletions docs/TranscoderPar.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ Added in v2.0.0
- [deriveTranscoderPar](#derivetranscoderpar)
- [Model](#model)
- [TranscoderPar (interface)](#transcoderpar-interface)
- [utils](#utils)
- [URI](#uri)
- [URI](#uri)
- [URI](#uri-1)
- [URI (type alias)](#uri-type-alias)

---
Expand Down Expand Up @@ -110,7 +110,7 @@ export interface TranscoderPar<I, O> {

Added in v2.0.0

# utils
# URI

## URI

Expand Down
38 changes: 19 additions & 19 deletions docs/TypeString.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,62 +16,62 @@ Added in v2.0.0

<h2 class="text-delta">Table of contents</h2>

- [Instances](#instances)
- [URI](#uri)
- [URI (type alias)](#uri-type-alias)
- [Interpreters](#interpreters)
- [deriveTypeString](#derivetypestring)
- [Model](#model)
- [TypeString (type alias)](#typestring-type-alias)
- [URI](#uri)
- [URI](#uri-1)
- [URI (type alias)](#uri-type-alias)

---

# Instances
# Interpreters

## URI
## deriveTypeString

Interprets a schema as a type string

**Signature**

```ts
export declare const URI: 'schemata-ts/TypeString'
export declare const deriveTypeString: Interpreter<SchemableLambda>
```
Added in v2.0.0
## URI (type alias)
# Model
## TypeString (type alias)
Input / Output type strings for a schema
**Signature**
```ts
export type URI = typeof URI
export type TypeString<I, O> = Const<readonly [string, string], readonly [I, O]>
```
Added in v2.0.0
# Interpreters
## deriveTypeString
# URI
Interprets a schema as a type string
## URI
**Signature**
```ts
export declare const deriveTypeString: Interpreter<SchemableLambda>
export declare const URI: 'schemata-ts/TypeString'
```
Added in v2.0.0
# Model
## TypeString (type alias)
Input / Output type strings for a schema
## URI (type alias)
**Signature**
```ts
export type TypeString<I, O> = Const<readonly [string, string], readonly [I, O]>
export type URI = typeof URI
```
Added in v2.0.0
8 changes: 4 additions & 4 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ nav_order: 0
</h1>

<p align="center">
A TypeScript schema engine written with fp-ts and a collection of schemata inspired by io-ts and validators.js.
An all-inclusive schema engine featuring schemata inspired by io-ts and validators.js. Written for TypeScript with fp-ts
</p>

<br><br>
Expand Down Expand Up @@ -186,7 +186,7 @@ or, (De)Serialization from a Base-64 encoded Json String:

```ts
const parsePersonTranscoder: Transcoder<S.Base64, Person> = deriveTranscoder(
S.ParseBase64String(PersonSchema),
S.ParseBase64Json(PersonSchema),
)
```

Expand Down Expand Up @@ -223,12 +223,12 @@ const guardPerson: Guard<Person> = deriveGuard(PersonSchema)

## JSON Schema (Draft 7, 2019-09, and 2020-12)

Json-Schema is a standard for describing JSON data. Schemata-ts can derive Json-Schema from schemas using `deriveJsonSchema` for versions 7, 2019-09, and 2020-12.
Json-Schema is a standard for describing JSON data. Schemata-ts can derive Json-Schema from schemas using `deriveJsonSchema` for versions Draft-07, 2019-09, and 2020-12.

```ts
import { deriveJsonSchema } from 'schemata-ts/JsonSchema'

const personJsonSchema2007 = deriveJsonSchema(PersonSchema, 'Draft-07')
const personJsonSchemaDraft07 = deriveJsonSchema(PersonSchema, 'Draft-07')
const personJsonSchema2019 = deriveJsonSchema(PersonSchema)
const personJsonSchema2020 = deriveJsonSchema(PersonSchema, '2020-12')
```
Expand Down
30 changes: 15 additions & 15 deletions docs/schemata/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,23 +81,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: `;P,O.`, `7dq\DfN`, `l,v/B^`)
* 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: `cW++/d2F70+k+b+69w/exQ+72+4+0mD2vzxvz+==`, `wsbo+y+180+9T+UY`, `t1MhM/V/1/==`)
* 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: `-B6-b-J_`, `bWH_jy02`, `-qp_-e-7W`)
* 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: `1y3wuLYLoMsJsLHpCA24951J6fTbmFxGL`, `2sRSr7KaGqJkCPRU9Bc6EwQasJbE1QBrK4LHqHWZ`, `bc1b70v0v8ekdk3h6072woe0vt10`)
* 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: `-q(qd[`, `L-/.k`, `} ~%~~ `)
* 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: `y9no/2+/+w+/`, `8/x+6++b/3V34/+/1/y7/hqeqi0+ua//2/==`, `/d+oYtD/J9u/6OmK/F2z`)
* 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_--4zR3_`, `-_3_-m-t`, `I0c_0E20c`)
* 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: `bc1c56vzx50f7810f59q3860jh0h5551ny0h08yhh`, `27JJ8bcGQfVPxMHYjcW9HLNLwVQJmg554T`, `3XA2HLN3pgnZ6KEJb4y7aP2pG4`)
* 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: `50802869650506291`, `50813089171065027`, `8280336629637564`)
* 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: `#*.}!%o!$.&.+~{/'?~r%.-~.*}&|?$WD.^+'.{.=$=#/#?@[06.89.89.205]`, `+}4{Y}/+|.*0}#./*k}_Kt=~|._=~~7%{-.%#$-'@c0l-9L.-m6RHnZo.-IV.TVqXDcDUv`, `vv^.$&#-{!?.&^_#/~8=$+._-$.}?%_{/~.?!-#=*~/'@[0.700.06.2]`)
* 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: `0xD07dAB0c2b9aA3EEcDae7Dd715d7c5A1DaecB877`, `0x2c8e1d0F2fA1C0dfd86e12C4A6cdBE5fDce0Ac43`, `0xaaB33BcAD3EEcba10Cdc858D3210CBb9Bdf1619d`)
* 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: `079e869E`, `FB8AcddB`, `#0AB0Bd`)
* 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: `0he4a3f`, `0HA9BA`, `dccE82DbFcb`)
* 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(.2040e14410824turn00000093.356811%0000000100%)`, `hsla(8.566837252,+00.74815056706%,000100%,907709)`, `hsl(.213885e05000100%00000092%/5171.670624%)`)
* 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: `.D_K3b`, `kc--u-1-5-.Ex`, `-5.9x2`)
* 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: `81,-139.25775`, `(80,180.00000000)`, `-90.00,179`)
* 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: `cf4ddd4d`, `332dd1ee17`, `YDxV&#P!z`)
* 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(0%,23%,100%,1)`, `rgb(1%,4%,1%)`, `rgba(3%,95%,100%,.07839379762)`)
* 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: `6288951674401889338`, `50888316910813106`, `624049060187145176`)
* 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: `$|!0.'|.}&/#$W&&.*+!Y'.|.-0^=?*|.%#~$#|/!*-._?!/+&-=r$#.%{*+*~&$||[email protected]`, `e^%~=^*_0&.~$@[725.2.31.6]`, `OO$?$K!|^.{._.=?{?/.8}-{_.|._~-.!#.='9|^/?--**.=*@5bZ39h.--99-l-4-.A-.QT8418..dIX5m74.p2-.axkmk`)
* 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: `0xCCBB14a2cDb5ac8CEEbd728cdbD1DFBBc1c1FCda`, `0x860ABd5cf48EB9bC5cACC072FDf7B1EeFACfACF2`, `0xDF1eaaf3bbB3A9b2CFbA60ebCeFbc8EdAf91dcf1`)
* 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: `#eBB207Cf`, `#0fC02a`, `#c2aCBAA3`)
* 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: `E2b4eDB5bfF`, `342aA6`, `CFAa97B7EDD8`)
* 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(52481496e-42270,+00000000100.0000000e-8479374789%,0000000.27755280e3407%)`, `hsl(.8+00000000090%+00000000.3e-740%)`, `hsla(.347,+00000000.3045942%,0000000.89%)`)
* 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: `--_5S5.cX`, `-hs.__.-Q6e954__`, `_.66_-Lx__v_`)
* 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: `(7.5610,180.00000000000)`, `80.7233805,180.0`, `(89,-106.3778803659)`)
* 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: `applycon`, `fbcda4be29`, `/toStri=`)
* 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%,91%,8%,0.629375)`, `rgba(100%,42%,98%,0)`, `rgba(100%,97%,95%,0)`)
* 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: `df01cBAE-ADBa-6A7a-eE11-136eD26a6313`, `cf1CfAc6-Bcb9-E1cf-8ac5-bEA0cCa0AAae`, `9cecbfE9-eBDB-Ca2a-Fef9-10bBdE0f6Ddd`)
* 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: `3bde7Ba8-3AE0-2C4C-CE9D-CCa9DA990B9d`, `C3Fb0dB2-B369-b9f3-FeEA-80CaBC6Fa05F`, `5Bf663aF-f03c-FedA-2DaE-0e8ebF29DCCA`)

### Unknown (3)

Expand Down
2 changes: 1 addition & 1 deletion docs/simple-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const Person = S.Struct({

> Use `S.InputOf` to extract the underlying input type, and `S.OutputOf` to extract the underlying output type.
The `Person` schema has nearly identical input/output types, with one exception. The `favoriteColor` key, may be present or not with the input type, but will always be present in the output type.
The `Person` schema has nearly identical input/output types, with one exception. The `favoriteColor` key may be present or not in the input type, but will always be present in the output type.

<!-- AUTO-GENERATED-CONTENT:START (CODE:src=../examples/simple-example.ts&lines=24-36) -->
<!-- The below code snippet is automatically added from ../examples/simple-example.ts -->
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "schemata-ts",
"version": "2.0.0",
"description": "A TypeScript schema engine written with fp-ts and a collection of schemata inspired by io-ts and validators.js",
"description": "An all-inclusive schema engine featuring schemata inspired by io-ts and validators.js. Written for TypeScript with fp-ts",
"homepage": "https://jacob-alford.github.io/schemata-ts/",
"repository": {
"type": "git",
Expand Down
25 changes: 16 additions & 9 deletions src/JsonSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,28 @@ export const intersection =
<A>(left: Const<JsonSchema, A>): Const<JsonSchema, A & B> =>
make(new I.JsonIntersection([left, right]))

/**
* A reference to a schema definition
*
* @since 2.0.0
* @category Constructors
*/
export const ref = <A>(ref: string): Const<JsonSchema, A> => make(new I.JsonRef(ref))

// -------------------------------------------------------------------------------------
// Instances
// -------------------------------------------------------------------------------------

/** @since 1.2.0 */
/**
* @since 1.2.0
* @category URI
*/
export const URI = 'schemata-ts/JsonSchema'

/** @since 1.2.0 */
/**
* @since 1.2.0
* @category URI
*/
export type URI = typeof URI

declare module 'fp-ts/lib/HKT' {
Expand Down Expand Up @@ -275,13 +289,6 @@ export const annotate: (params?: {
...(deprecated === undefined ? {} : { deprecated }),
})

/**
* A reference to a schema definition
*
* @since 2.0.0
*/
export const ref = <A>(ref: string): Const<JsonSchema, A> => make(new I.JsonRef(ref))

// -------------------------------------------------------------------------------------
// Destructors
// -------------------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit 6963663

Please sign in to comment.