Skip to content
This repository was archived by the owner on Mar 20, 2022. It is now read-only.

Commit bd5a7a4

Browse files
committed
Add documentation for definition method on schema. Fixes gh-195
1 parent 2522bb9 commit bd5a7a4

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

docs/api.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ Can be a string or a function. If given a function, accepts the following argume
4141
* `parent`: The parent object of the input array.
4242
* `key`: The key at which the input array appears on the parent object.
4343

44+
#### Instance Methods
45+
46+
* `define(definition)`: When used, the `definition` passed in will be merged with the original definition passed to the `Array` constructor. This method tends to be useful for creating circular references in schema.
47+
4448
#### Usage
4549

4650
To describe a simple array of a singular entity type:
@@ -89,6 +93,11 @@ You *do not* need to define any keys in your entity other than those that hold n
8993
* `parent`: The parent object of the input array.
9094
* `key`: The key at which the input array appears on the parent object.
9195

96+
#### Instance Methods
97+
98+
* `define(definition)`: When used, the `definition` passed in will be merged with the original definition passed to the `Entity` constructor. This method tends to be useful for creating circular references in schema.
99+
* `key`: Returns the key provided to the constructor.
100+
92101
#### Usage
93102

94103
```js
@@ -115,6 +124,10 @@ Define a plain object mapping that has values needing to be normalized into Enti
115124
* `definition`: **required** A definition of the nested entities found within this object. Defaults to empty object.
116125
You *do not* need to define any keys in your object other than those that hold other entities. All other values will be copied to the normalized output.
117126

127+
#### Instance Methods
128+
129+
* `define(definition)`: When used, the `definition` passed in will be merged with the original definition passed to the `Object` constructor. This method tends to be useful for creating circular references in schema.
130+
118131
#### Usage
119132

120133
```js
@@ -140,6 +153,10 @@ Can be a string or a function. If given a function, accepts the following argume
140153
* `parent`: The parent object of the input array.
141154
* `key`: The key at which the input array appears on the parent object.
142155

156+
#### Instance Methods
157+
158+
* `define(definition)`: When used, the `definition` passed in will be merged with the original definition passed to the `Union` constructor. This method tends to be useful for creating circular references in schema.
159+
143160
#### Usage
144161

145162
```js
@@ -166,6 +183,10 @@ Can be a string or a function. If given a function, accepts the following argume
166183
* `parent`: The parent object of the input array.
167184
* `key`: The key at which the input array appears on the parent object.
168185

186+
#### Instance Methods
187+
188+
* `define(definition)`: When used, the `definition` passed in will be merged with the original definition passed to the `Values` constructor. This method tends to be useful for creating circular references in schema.
189+
169190
#### Usage
170191

171192
```js

0 commit comments

Comments
 (0)