Used to store authority lookup results. If no cache passed in, one will be created for you.
A spot to put your own arbitrary data.
This is passed through to some hook functions, such as transformRef
and Reader.read
.
Hook to customize which properties are resolved.
By default, only $ref
keys are considered and processed.
If defined, this hook is called for every single property in source, so it should be performant!
It should return the string to be resolved, or nothing to skip.
Note, this overrides the default behavior. If you would like to preserve that, call the exported defaultGetRef
as part of your custom getRef
function.
Hook to customize how the result of an authority look is parsed.
For example, could use js-yaml
to parse a yaml string returned from the authority.
Readers define how to read pointers for different schemes (http, file, mongo, whatever).
If you do not pass in any readers, only local pointer resolution will work #/foo/bar
.
Should we resolve authorities? true by default.
Note, must have a reader defined for the authority scheme in question.
Should we resolve local pointers? true by default.
Hook to transform the final ref value before it is resolved.
It should return a URI object to change the value being resolved, or void to make no changes.
The options that you can pass to
new Resolver(opts)