Package io.zerocopy.json.schema
Class SchemaUtils
- java.lang.Object
-
- io.zerocopy.json.schema.SchemaUtils
-
public class SchemaUtils extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceSchemaUtils.NodeVisitor
-
Field Summary
Fields Modifier and Type Field Description static com.fasterxml.jackson.databind.ObjectMapperOBJECT_MAPPERstatic java.util.Comparator<java.util.regex.Pattern>PATTERN_COMPARATOR
-
Constructor Summary
Constructors Constructor Description SchemaUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidfindAllRefsInSchema(com.fasterxml.jackson.databind.JsonNode rootNode, com.fasterxml.jackson.databind.JsonNode schemaNode, java.util.Set<java.lang.String> refsOut)static com.fasterxml.jackson.databind.JsonNoderesolveRelativeRef(com.fasterxml.jackson.databind.JsonNode rootNode, com.fasterxml.jackson.databind.JsonNode referringNode, java.lang.String ref)Resolves a node according to a ref.static SchemaReferenceresolveRelativeRefPath(java.util.List<java.lang.String> pathOut, com.fasterxml.jackson.databind.JsonNode rootNode, com.fasterxml.jackson.databind.JsonNode referringNode, java.lang.String ref)Resolves a node according to a ref.static voidvisitAllNodes(com.fasterxml.jackson.databind.JsonNode node, SchemaUtils.NodeVisitor visitor)static voidvisitAllNodes(java.util.LinkedList<java.lang.String> path, com.fasterxml.jackson.databind.JsonNode node, SchemaUtils.NodeVisitor visitor)
-
-
-
Method Detail
-
resolveRelativeRef
public static com.fasterxml.jackson.databind.JsonNode resolveRelativeRef(com.fasterxml.jackson.databind.JsonNode rootNode, com.fasterxml.jackson.databind.JsonNode referringNode, java.lang.String ref)Resolves a node according to a ref. In case the ref starts with '#', the search is started at the root node. An all other cases, the search starts at the referring node.- Parameters:
rootNode- the root node of the referring nodereferringNode- the node which contains the referenceref- an URL-encoded reference- Returns:
- the resolved JSON node or null, if not found
-
resolveRelativeRefPath
public static SchemaReference resolveRelativeRefPath(java.util.List<java.lang.String> pathOut, com.fasterxml.jackson.databind.JsonNode rootNode, com.fasterxml.jackson.databind.JsonNode referringNode, java.lang.String ref)
Resolves a node according to a ref. In case the ref starts with '#', the search is started at the root node. An all other cases, the search starts at the referring node.- Parameters:
pathOut- path output listrootNode- the root node of the referring nodereferringNode- the node which contains the referenceref- an URL-encoded reference- Returns:
- the resolved JSON node or null, if not found
-
visitAllNodes
public static void visitAllNodes(com.fasterxml.jackson.databind.JsonNode node, SchemaUtils.NodeVisitor visitor)
-
visitAllNodes
public static void visitAllNodes(java.util.LinkedList<java.lang.String> path, com.fasterxml.jackson.databind.JsonNode node, SchemaUtils.NodeVisitor visitor)- Parameters:
path- the base pathnode- the node to start at (corresponding to the specified path)visitor- the visitor
-
findAllRefsInSchema
public static void findAllRefsInSchema(com.fasterxml.jackson.databind.JsonNode rootNode, com.fasterxml.jackson.databind.JsonNode schemaNode, java.util.Set<java.lang.String> refsOut)
-
-