Options
All
  • Public
  • Public/Protected
  • All
Menu

The options that you can pass to new Resolver(opts)

Hierarchy

Index

Properties

Optional authorityCache

authorityCache: ICache

Used to store authority lookup results. If no cache passed in, one will be created for you.

Optional ctx

ctx: any

A spot to put your own arbitrary data.

This is passed through to some hook functions, such as transformRef and Reader.read.

Optional getRef

getRef: undefined | function

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.

Optional parseAuthorityResult

parseAuthorityResult: undefined | 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.

Optional readers

readers: undefined | object

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.

Optional resolveAuthorities

resolveAuthorities: undefined | false | true

Should we resolve authorities? true by default.

Note, must have a reader defined for the authority scheme in question.

Optional resolvePointers

resolvePointers: undefined | false | true

Should we resolve local pointers? true by default.

Optional transformRef

transformRef: undefined | function

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.