Skip to content

Commit 28c38a1

Browse files
committed
change: method names for consistency
1 parent d2fb8ed commit 28c38a1

37 files changed

+441
-429
lines changed

README.md

Lines changed: 230 additions & 218 deletions
Large diffs are not rendered by default.

src/SchemaNode.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -205,20 +205,20 @@ export const SchemaNodeMethods = {
205205
/**
206206
* @returns for $ref, the corresponding SchemaNode or undefined
207207
*/
208-
getRef($ref: string): SchemaNode | undefined {
208+
getNodeRef($ref: string): SchemaNode | undefined {
209209
const node = this as SchemaNode;
210210
return node.compileSchema({ $ref }).resolveRef();
211211
},
212212

213-
getRootNode() {
213+
getNodeRoot() {
214214
const node = this as SchemaNode;
215215
return node.context.rootNode;
216216
},
217217

218218
/**
219219
* @returns child node identified by property as SchemaNode
220220
*/
221-
getChild(key: string | number, data?: unknown, options: GetNodeOptions = {}): OptionalNodeOrError {
221+
getNodeChild(key: string | number, data?: unknown, options: GetNodeOptions = {}): OptionalNodeOrError {
222222
options.path = options.path ?? [];
223223

224224
options.withSchemaWarning = options.withSchemaWarning ?? false;
@@ -227,7 +227,7 @@ export const SchemaNodeMethods = {
227227

228228
let node = this as SchemaNode;
229229
if (node.reducers.length) {
230-
const result = node.reduceSchema(data, { key, path, pointer });
230+
const result = node.reduceNode(data, { key, path, pointer });
231231
if (result.error) {
232232
return result;
233233
}
@@ -248,7 +248,7 @@ export const SchemaNodeMethods = {
248248

249249
const referencedNode = node.resolveRef({ path });
250250
if (referencedNode !== node) {
251-
return referencedNode.getChild(key, data, options);
251+
return referencedNode.getNodeChild(key, data, options);
252252
}
253253

254254
if (options.createSchema === true) {
@@ -292,7 +292,7 @@ export const SchemaNodeMethods = {
292292
/**
293293
* @returns SchemaNode with a reduced JSON Schema matching the given data
294294
*/
295-
reduceSchema(
295+
reduceNode(
296296
data: unknown,
297297
options: { key?: string | number; pointer?: string; path?: ValidationPath } = {}
298298
): OptionalNodeOrError {
@@ -381,7 +381,7 @@ export const SchemaNodeMethods = {
381381
* Register a JSON Schema as a remote-schema to be resolved by $ref, $anchor, etc
382382
* @returns the current node (not the remote schema-node)
383383
*/
384-
addRemote(url: string, schema: JsonSchema): SchemaNode {
384+
addRemoteSchema(url: string, schema: JsonSchema): SchemaNode {
385385
// @draft >= 6
386386
schema.$id = joinId(schema.$id || url);
387387
const { context } = this as SchemaNode;

src/compileSchema.getChild.test.ts

Lines changed: 56 additions & 56 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)