Skip to content

Commit 1a62ccf

Browse files
committed
Document the 'excludedPathMatcher' dereference option
1 parent 6f1d589 commit 1a62ccf

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

docs/options.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ $RefParser.dereference("my-schema.yaml", {
2929
}
3030
},
3131
dereference: {
32-
circular: false // Don't allow circular $refs
32+
circular: false, // Don't allow circular $refs
33+
excludedPathMatcher: (path) => // Skip dereferencing content under any 'example' key
34+
path.includes("/example/")
3335
}
3436
});
3537
```
@@ -75,3 +77,4 @@ The `dereference` options control how JSON Schema $Ref Parser will dereference `
7577
|Option(s) |Type |Description
7678
|:---------------------|:-------------------|:------------
7779
|`circular`|`boolean` or `"ignore"`|Determines whether [circular `$ref` pointers](README.md#circular-refs) are handled.<br><br>If set to `false`, then a `ReferenceError` will be thrown if the schema contains any circular references.<br><br> If set to `"ignore"`, then circular references will simply be ignored. No error will be thrown, but the [`$Refs.circular`](refs.md#circular) property will still be set to `true`.
80+
|`excludedPathMatcher`|`(string) => boolean`|A function, called for each path, which can return true to stop this path and all subpaths from being dereferenced further. This is useful in schemas where some subpaths contain literal $ref keys that should not be dereferenced.

0 commit comments

Comments
 (0)