Skip to content

Commit

Permalink
fix: undo debugging stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
BelfordZ committed Mar 12, 2024
1 parent 77a77f6 commit 516cea9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/index.test.ts
Expand Up @@ -512,7 +512,7 @@ describe("traverse", () => {
};
schema.properties.foo.anyOf[0].items.properties.baz = schema;
schema.properties.bar.allOf[0].properties.baz = schema.properties.foo.anyOf[0];
const mockMutation = jest.fn((s) => { console.log(s); return s; });
const mockMutation = jest.fn((s) => s);
traverse(schema as JSONSchema, mockMutation);
expect(mockMutation).toHaveBeenCalledTimes(6);
});
Expand Down
5 changes: 2 additions & 3 deletions src/index.ts
Expand Up @@ -6,7 +6,7 @@ import { JSONSchema, JSONSchemaObject, PatternProperties } from "@json-schema-to
* @param schema The schema or subschema node being traversed
* @param isCycle false if the schema passed is not the root of a detected cycle. Useful for special handling of cycled schemas.
* @param path json-path string in dot-notation as per [draft-goessner-dispatch-jsonpath-00](https://www.ietf.org/archive/id/draft-goessner-dispatch-jsonpath-00.html#name-overview-of-jsonpath-expres)
* @param parent if the schema is the root, this will be the same as `schema`. Otherwise, it will be a reference to JSONSchema that is the parent.
* @param parent A reference to JSONSchema that is the parent of the `schema` param. If the `schema` is the root schema, `parent` will be `undefined`. when schema is a cycle, parent is the parent of the referenced cycle (once again, if the cycled schema is the root, the parent will be undefined).
*/
export type MutationFunction = (
schema: JSONSchema,
Expand Down Expand Up @@ -111,7 +111,7 @@ export default function traverse(
schema,
false,
jsonPathStringify(pathStack),
last(mutableStack) || schema
last(mutableStack)
);
}
}
Expand Down Expand Up @@ -274,7 +274,6 @@ export default function traverse(
return mutableSchema;
} else {
const isCycle = cycleSet.indexOf(schema) !== -1
//console.log(recursiveStack, depth, mutableSchema);
const mutated = mutation(
mutableSchema,
isCycle,
Expand Down

0 comments on commit 516cea9

Please sign in to comment.