File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -67,13 +67,32 @@ Supported types:
6767
6868And nested ones, too.
6969
70- * Specific use cases: *
70+ #### Specific use cases
7171
7272| Instance | Serialized as |
7373| -----------| ---------------------------------------------|
74- | ` Date ` | ` string ` < small > via ` toISOString() ` </ small > |
74+ | ` Date ` | ` string ` via ` toISOString() ` |
7575| ` RegExp ` | ` string ` |
7676
77+ #### Required
78+ You can set specific fields of an object as ` required ` in your schema, by adding ` required: true ` inside the key properties.
79+ Example:
80+ ``` javascript
81+ const schema = {
82+ title: ' Example Schema with required field' ,
83+ type: ' object' ,
84+ properties: {
85+ nickname: {
86+ type: ' string'
87+ },
88+ mail: {
89+ type: ' string' ,
90+ required: true
91+ }
92+ }
93+ }
94+ ```
95+ If the object to stringify has not the required field(s), ` fast-json-stringify ` will throw an error.
7796
7897## Acknowledgements
7998
You can’t perform that action at this time.
0 commit comments