Class SchemaUtils


  • public class SchemaUtils
    extends java.lang.Object
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  SchemaUtils.NodeVisitor  
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static com.fasterxml.jackson.databind.ObjectMapper OBJECT_MAPPER  
      static 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 void findAllRefsInSchema​(com.fasterxml.jackson.databind.JsonNode rootNode, com.fasterxml.jackson.databind.JsonNode schemaNode, java.util.Set<java.lang.String> refsOut)  
      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.
      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.
      static void visitAllNodes​(com.fasterxml.jackson.databind.JsonNode node, SchemaUtils.NodeVisitor visitor)  
      static void visitAllNodes​(java.util.LinkedList<java.lang.String> path, com.fasterxml.jackson.databind.JsonNode node, SchemaUtils.NodeVisitor visitor)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • OBJECT_MAPPER

        public static final com.fasterxml.jackson.databind.ObjectMapper OBJECT_MAPPER
      • PATTERN_COMPARATOR

        public static final java.util.Comparator<java.util.regex.Pattern> PATTERN_COMPARATOR
    • Constructor Detail

      • SchemaUtils

        public SchemaUtils()
    • 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 node
        referringNode - the node which contains the reference
        ref - 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 list
        rootNode - the root node of the referring node
        referringNode - the node which contains the reference
        ref - 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 path
        node - 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)