Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve docs #58

Merged
merged 1 commit into from
Jan 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,8 @@ console.log(schema.isFluentSchema) // true

## Documentation

[API Doc](./docs/API.md).
[JSON schema reference](https://json-schema.org/latest/json-schema-validation.html):
- [Full API Documentation](./docs/API.md).
- [JSON schema reference](https://json-schema.org/latest/json-schema-validation.html).

## Acknowledgments

Expand Down
50 changes: 45 additions & 5 deletions docs/API.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Functions

<dl>
<dt><a href="#ArraySchema">ArraySchema([options])</a> ⇒ <code><a href="#StringSchema">StringSchema</a></code></dt>
<dt><a href="#ArraySchema">ArraySchema([options])</a> ⇒ <code><a href="#ArraySchema">ArraySchema</a></code></dt>
<dd><p>Represents a ArraySchema.</p>
</dd>
<dt><a href="#items">items(items)</a> ⇒ <code>FluentSchema</code></dt>
Expand Down Expand Up @@ -66,6 +66,16 @@ There are no restrictions placed on the values within the array.</p>
<dd><p>There are no restrictions placed on the value of this keyword.</p>
<p><a href="reference">https://json-schema.org/latest/json-schema-validation.html#rfc.section.10.2</a></p>
</dd>
<dt><a href="#readOnly">readOnly(isReadOnly)</a> ⇒ <code><a href="#BaseSchema">BaseSchema</a></code></dt>
<dd><p>The value of readOnly can be left empty to indicate the property is readOnly.
It takes an optional boolean which can be used to explicitly set readOnly true/false</p>
<p><a href="#readOnly">https://json-schema.org/latest/json-schema-validation.html#rfc.section.10.3</a></p>
</dd>
<dt><a href="#writeOnly">writeOnly(isWriteOnly)</a> ⇒ <code><a href="#BaseSchema">BaseSchema</a></code></dt>
<dd><p>The value of writeOnly can be left empty to indicate the property is writeOnly.
It takes an optional boolean which can be used to explicitly set writeOnly true/false</p>
<p><a href="#writeOnly">https://json-schema.org/latest/json-schema-validation.html#rfc.section.10.3</a></p>
</dd>
<dt><a href="#required">required()</a> ⇒ <code>FluentSchema</code></dt>
<dd><p>Required has to be chained to a property:
Examples:</p>
Expand Down Expand Up @@ -246,7 +256,7 @@ The length of a string instance is defined as the number of its characters as de

<a name="ArraySchema"></a>

## ArraySchema([options]) ⇒ [<code>StringSchema</code>](#StringSchema)
## ArraySchema([options]) ⇒ [<code>ArraySchema</code>](#ArraySchema)

Represents a ArraySchema.

Expand Down Expand Up @@ -464,6 +474,36 @@ There are no restrictions placed on the value of this keyword.
| -------- |
| defaults |

<a name="readOnly"></a>

## readOnly(isReadOnly) ⇒ [<code>BaseSchema</code>](#BaseSchema)

The value of readOnly can be left empty to indicate the property is readOnly.
It takes an optional boolean which can be used to explicitly set readOnly true/false

[https://json-schema.org/latest/json-schema-validation.html#rfc.section.10.3](#readOnly)

**Kind**: global function

| Param | Type |
| ---------- | ---------------------------------------------------------- |
| isReadOnly | [<code>boolean</code>](#boolean) \| <code>undefined</code> |

<a name="writeOnly"></a>

## writeOnly(isWriteOnly) ⇒ [<code>BaseSchema</code>](#BaseSchema)

The value of writeOnly can be left empty to indicate the property is writeOnly.
It takes an optional boolean which can be used to explicitly set writeOnly true/false

[https://json-schema.org/latest/json-schema-validation.html#rfc.section.10.3](#writeOnly)

**Kind**: global function

| Param | Type |
| ----------- | ---------------------------------------------------------- |
| isWriteOnly | [<code>boolean</code>](#boolean) \| <code>undefined</code> |

<a name="required"></a>

## required() ⇒ <code>FluentSchema</code>
Expand Down Expand Up @@ -655,9 +695,9 @@ A mixed schema is the union of multiple types (e.g. ['string', 'integer']

**Kind**: global function

| Param | Type |
| ----- | -------------------------------------------- |
| types | [<code>Array.&lt;string&gt;</code>](#string) |
| Param | Type |
| ----- | ------------------------------------------------------------ |
| types | [<code>[ &#x27;Array&#x27; ].&lt;string&gt;</code>](#string) |

<a name="IntegerSchema"></a>

Expand Down
2 changes: 1 addition & 1 deletion src/ArraySchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const initialState = {
* @param {Object} [options] - Options
* @param {StringSchema} [options.schema] - Default schema
* @param {boolean} [options.generateIds = false] - generate the id automatically e.g. #properties.foo
* @returns {StringSchema}
* @returns {ArraySchema}
*/
// https://medium.com/javascript-scene/javascript-factory-functions-with-es6-4d224591a8b1
// Factory Functions for Mixin Composition withBaseSchema
Expand Down