Skip to content

Commit 516cea9

Browse files
committed
fix: undo debugging stuff
1 parent 77a77f6 commit 516cea9

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ describe("traverse", () => {
512512
};
513513
schema.properties.foo.anyOf[0].items.properties.baz = schema;
514514
schema.properties.bar.allOf[0].properties.baz = schema.properties.foo.anyOf[0];
515-
const mockMutation = jest.fn((s) => { console.log(s); return s; });
515+
const mockMutation = jest.fn((s) => s);
516516
traverse(schema as JSONSchema, mockMutation);
517517
expect(mockMutation).toHaveBeenCalledTimes(6);
518518
});

src/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { JSONSchema, JSONSchemaObject, PatternProperties } from "@json-schema-to
66
* @param schema The schema or subschema node being traversed
77
* @param isCycle false if the schema passed is not the root of a detected cycle. Useful for special handling of cycled schemas.
88
* @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)
9-
* @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.
9+
* @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).
1010
*/
1111
export type MutationFunction = (
1212
schema: JSONSchema,
@@ -111,7 +111,7 @@ export default function traverse(
111111
schema,
112112
false,
113113
jsonPathStringify(pathStack),
114-
last(mutableStack) || schema
114+
last(mutableStack)
115115
);
116116
}
117117
}
@@ -274,7 +274,6 @@ export default function traverse(
274274
return mutableSchema;
275275
} else {
276276
const isCycle = cycleSet.indexOf(schema) !== -1
277-
//console.log(recursiveStack, depth, mutableSchema);
278277
const mutated = mutation(
279278
mutableSchema,
280279
isCycle,

0 commit comments

Comments
 (0)