mirror of https://github.com/apache/lucene.git
SOLR-10647: move JsonSchemaValidator to SolrJ
This commit is contained in:
parent
d7ff0e2b70
commit
f14f2ef6a6
|
@ -24,7 +24,7 @@ import org.apache.solr.common.SpecProvider;
|
||||||
import org.apache.solr.common.util.ValidatingJsonMap;
|
import org.apache.solr.common.util.ValidatingJsonMap;
|
||||||
import org.apache.solr.request.SolrQueryRequest;
|
import org.apache.solr.request.SolrQueryRequest;
|
||||||
import org.apache.solr.response.SolrQueryResponse;
|
import org.apache.solr.response.SolrQueryResponse;
|
||||||
import org.apache.solr.util.JsonSchemaValidator;
|
import org.apache.solr.common.util.JsonSchemaValidator;
|
||||||
|
|
||||||
/** Every version 2 API must extend the this class. It's mostly like a request handler
|
/** Every version 2 API must extend the this class. It's mostly like a request handler
|
||||||
* but it has extra methods to provide the json schema of the end point
|
* but it has extra methods to provide the json schema of the end point
|
||||||
|
|
|
@ -44,7 +44,7 @@ import org.apache.solr.request.SolrRequestHandler;
|
||||||
import org.apache.solr.response.SolrQueryResponse;
|
import org.apache.solr.response.SolrQueryResponse;
|
||||||
import org.apache.solr.security.AuthorizationContext;
|
import org.apache.solr.security.AuthorizationContext;
|
||||||
import org.apache.solr.security.PermissionNameProvider;
|
import org.apache.solr.security.PermissionNameProvider;
|
||||||
import org.apache.solr.util.JsonSchemaValidator;
|
import org.apache.solr.common.util.JsonSchemaValidator;
|
||||||
import org.apache.solr.common.util.PathTrie;
|
import org.apache.solr.common.util.PathTrie;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
|
@ -48,7 +48,7 @@ import org.apache.solr.security.AuthorizationContext;
|
||||||
import org.apache.solr.servlet.HttpSolrCall;
|
import org.apache.solr.servlet.HttpSolrCall;
|
||||||
import org.apache.solr.servlet.SolrDispatchFilter;
|
import org.apache.solr.servlet.SolrDispatchFilter;
|
||||||
import org.apache.solr.servlet.SolrRequestParsers;
|
import org.apache.solr.servlet.SolrRequestParsers;
|
||||||
import org.apache.solr.util.JsonSchemaValidator;
|
import org.apache.solr.common.util.JsonSchemaValidator;
|
||||||
import org.apache.solr.common.util.PathTrie;
|
import org.apache.solr.common.util.PathTrie;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
|
@ -46,7 +46,7 @@ import org.apache.solr.common.util.CommandOperation;
|
||||||
import org.apache.solr.api.Api;
|
import org.apache.solr.api.Api;
|
||||||
import org.apache.solr.api.ApiBag.ReqHandlerToApi;
|
import org.apache.solr.api.ApiBag.ReqHandlerToApi;
|
||||||
import org.apache.solr.common.SpecProvider;
|
import org.apache.solr.common.SpecProvider;
|
||||||
import org.apache.solr.util.JsonSchemaValidator;
|
import org.apache.solr.common.util.JsonSchemaValidator;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ import org.apache.solr.common.util.ValidatingJsonMap;
|
||||||
import org.apache.solr.common.util.SuppressForbidden;
|
import org.apache.solr.common.util.SuppressForbidden;
|
||||||
import org.apache.solr.search.SolrIndexSearcher;
|
import org.apache.solr.search.SolrIndexSearcher;
|
||||||
import org.apache.solr.common.util.CommandOperation;
|
import org.apache.solr.common.util.CommandOperation;
|
||||||
import org.apache.solr.util.JsonSchemaValidator;
|
import org.apache.solr.common.util.JsonSchemaValidator;
|
||||||
import org.apache.solr.util.RTimerTree;
|
import org.apache.solr.util.RTimerTree;
|
||||||
import org.apache.solr.util.RefCounted;
|
import org.apache.solr.util.RefCounted;
|
||||||
import org.apache.solr.schema.IndexSchema;
|
import org.apache.solr.schema.IndexSchema;
|
||||||
|
|
|
@ -102,7 +102,7 @@ import org.apache.solr.servlet.cache.HttpCacheHeaderUtil;
|
||||||
import org.apache.solr.servlet.cache.Method;
|
import org.apache.solr.servlet.cache.Method;
|
||||||
import org.apache.solr.update.processor.DistributingUpdateProcessorFactory;
|
import org.apache.solr.update.processor.DistributingUpdateProcessorFactory;
|
||||||
import org.apache.solr.common.util.CommandOperation;
|
import org.apache.solr.common.util.CommandOperation;
|
||||||
import org.apache.solr.util.JsonSchemaValidator;
|
import org.apache.solr.common.util.JsonSchemaValidator;
|
||||||
import org.apache.solr.util.RTimerTree;
|
import org.apache.solr.util.RTimerTree;
|
||||||
import org.apache.solr.util.TimeOut;
|
import org.apache.solr.util.TimeOut;
|
||||||
import org.apache.zookeeper.KeeperException;
|
import org.apache.zookeeper.KeeperException;
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.apache.solr.util;
|
package org.apache.solr.common.util;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -27,9 +27,6 @@ import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
import org.apache.solr.common.util.Pair;
|
|
||||||
import org.apache.solr.common.util.Utils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A very basic and lightweight json schema parsing and data validation tool. This custom tool is created
|
* A very basic and lightweight json schema parsing and data validation tool. This custom tool is created
|
||||||
* because a) we need to support non json inputs b) to avoiding double parsing (this accepts an already parsed json as a map)
|
* because a) we need to support non json inputs b) to avoiding double parsing (this accepts an already parsed json as a map)
|
|
@ -14,21 +14,18 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.solr.util;
|
package org.apache.solr.common.util;
|
||||||
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.apache.solr.common.util.ValidatingJsonMap;
|
|
||||||
import org.apache.solr.common.util.StrUtils;
|
|
||||||
import org.apache.solr.common.util.Utils;
|
|
||||||
|
|
||||||
import static org.apache.solr.common.util.ValidatingJsonMap.NOT_NULL;
|
|
||||||
import static org.apache.solr.common.util.Utils.toJSONString;
|
import static org.apache.solr.common.util.Utils.toJSONString;
|
||||||
|
import static org.apache.solr.common.util.ValidatingJsonMap.NOT_NULL;
|
||||||
|
|
||||||
public class JsonValidatorTest extends SolrTestCaseJ4 {
|
public class JsonValidatorTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
public void testSchema() {
|
public void testSchema() {
|
||||||
checkSchema("collections.Commands");
|
checkSchema("collections.Commands");
|
Loading…
Reference in New Issue