             continue
           }
         }
+      } else if let subschema = schema[component] as? Bool {
+        if !components.isEmpty {
+          return nil
+        }
+        return subschema
       }
 
       return nil

}

func urlJoin(_ lhs: String, _ rhs: String) -> String {
  if rhs.hasPrefix("#") {
    return lhs + rhs
  }
  return rhs
}

func urlNormalise(_ value: String) -> String {

    return nil
  }

  func resolve(document: [String: Any], fragment: String) -> Any? {
    guard !fragment.isEmpty else {
      return document
    }
