• Traverse all subschema of a schema, calling the mutator function with each. The mutator is called on leaf nodes first.

    Parameters

    • schema: JSONSchema

      the schema to traverse

    • mutation: MutationFunction

      the function to pass each node in the subschema tree.

    • traverseOptions: TraverseOptions = defaultOptions

      a set of options for traversal.

    • depth: number = 0

      For internal use. Tracks the current recursive depth in the tree. This is used to implement some of the options.

    • recursiveStack: JSONSchema[] = []
    • mutableStack: JSONSchema[] = []
    • pathStack: string[] = []
    • prePostMap: [JSONSchema, JSONSchema][] = []
    • cycleSet: JSONSchema[] = []

    Returns JSONSchema