You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/options.md
+9-10Lines changed: 9 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,30 +1,30 @@
1
1
Options
2
2
==========================
3
3
4
-
All [`$RefParser`](ref-parser.md) methods accept an optional `options` parameter, which you can use to customize how the JSON Schema is parsed, resolved, dereferenced, etc.
4
+
All [`$RefParser`](ref-parser.md) methods accept an optional `options` parameter, which you could use for customizing the JSON Schema with parsed, resolved, dereferenced, etc.
5
5
6
6
If you pass an options parameter, you _don't_ need to specify _every_ option. Any options you don't specify will use their default values.
7
7
8
-
Example
8
+
The example
9
9
-------------------
10
10
11
11
```javascript
12
-
$RefParser.dereference("my-schema.yaml", {
12
+
$RefParser.dereference('my-schema.yaml', {
13
13
parse: {
14
14
json:false, // Disable the JSON parser
15
15
yaml: {
16
16
allowEmpty:false// Don't allow empty YAML files
17
17
},
18
18
text: {
19
-
canParse: [".txt", ".html"], // Parse .txt and .html files as plain text (strings)
19
+
canParse: ['.txt', '.html'], // Parse .txt and .html files as plain text (strings)
20
20
encoding:'utf16'// Use UTF-16 encoding
21
21
}
22
22
},
23
23
resolve: {
24
24
file:false, // Don't resolve local file references
25
25
http: {
26
26
timeout:2000, // 2 second timeout
27
-
withCredentials:true,// Include auth credentials when resolving HTTP references
27
+
withCredentials:true// Include auth credentials when resolving HTTP references
The `parse`options determine how different types of files will be parsed.
38
+
The `parse`option determines the way of parsing for a different file types.
40
39
41
-
JSON Schema $Ref Parser comes with built-in JSON, YAML, plain-text, and binary parsers, any of which you can configure or disable. You can also add [your own custom parsers](plugins/parsers.md) if you want.
40
+
**The JSON Schema $Ref Parser** comes with built-in parsers for JSON, YAML, plain-text and binary files. You may configure and/or disable each of them. Also, you may add your own custom parsers following this [custom-parsers-manual](plugins/parsers.md).
|`json`<br>`yaml`<br>`text`<br>`binary`|`object``boolean`|These are the built-in parsers. In addition, you can add [your own custom parsers](plugins/parsers.md)<br><br>To disable a parser, just set it to `false`.
46
45
|`json.order``yaml.order``text.order``binary.order`|`number`|Parsers run in a specific order, relative to other parsers. For example, a parser with `order: 5` will run _before_ a parser with `order: 10`. If a parser is unable to successfully parse a file, then the next parser is tried, until one succeeds or they all fail.<br><br>You can change the order in which parsers run, which is useful if you know that most of your referenced files will be a certain type, or if you add [your own custom parser](plugins/parsers.md) that you want to run _first_.
0 commit comments