@@ -12,6 +12,26 @@ export type DeepPartial<T> = T extends object
1212 [ P in keyof T ] ?: DeepPartial < T [ P ] > ;
1313 }
1414 : T ;
15+
16+ export interface BundleOptions {
17+ /**
18+ * A function, called for each path, which can return true to stop this path and all
19+ * subpaths from being processed further. This is useful in schemas where some
20+ * subpaths contain literal $ref keys that should not be changed.
21+ */
22+ excludedPathMatcher ?( path : string ) : boolean ;
23+
24+ /**
25+ * Callback invoked during bundling.
26+ *
27+ * @argument {string} path - The path being processed (ie. the `$ref` string)
28+ * @argument {JSONSchemaObject} value - The JSON-Schema that the `$ref` resolved to
29+ * @argument {JSONSchemaObject} parent - The parent of the processed object
30+ * @argument {string} parentPropName - The prop name of the parent object whose value was processed
31+ */
32+ onBundle ?( path : string , value : JSONSchemaObject , parent ?: JSONSchemaObject , parentPropName ?: string ) : void ;
33+ }
34+
1535export interface DereferenceOptions {
1636 /**
1737 * Determines whether circular `$ref` pointers are handled.
@@ -107,6 +127,11 @@ export interface $RefParserOptions<S extends object = JSONSchema> {
107127 */
108128 continueOnError : boolean ;
109129
130+ /**
131+ * The `bundle` options control how JSON Schema `$Ref` Parser will process `$ref` pointers within the JSON schema.
132+ */
133+ bundle : BundleOptions ;
134+
110135 /**
111136 * The `dereference` options control how JSON Schema `$Ref` Parser will dereference `$ref` pointers within the JSON schema.
112137 */
@@ -168,6 +193,20 @@ export const getJsonSchemaRefParserDefaultOptions = () => {
168193 */
169194 continueOnError : false ,
170195
196+ /**
197+ * Determines the types of JSON references that are allowed.
198+ */
199+ bundle : {
200+ /**
201+ * A function, called for each path, which can return true to stop this path and all
202+ * subpaths from being processed further. This is useful in schemas where some
203+ * subpaths contain literal $ref keys that should not be changed.
204+ *
205+ * @type {function }
206+ */
207+ excludedPathMatcher : ( ) => false ,
208+ } ,
209+
171210 /**
172211 * Determines the types of JSON references that are allowed.
173212 */
0 commit comments