Browse Source

[SPEC] Removed _source endpoint from get api spec, as the get_source is a different api already

Also removed custom code that was required in the REST tests due to this.
Luca Cavanna 11 years ago
parent
commit
de893d80de

+ 1 - 1
rest-api-spec/api/get.json

@@ -4,7 +4,7 @@
     "methods": ["GET"],
     "url": {
       "path": "/{index}/{type}/{id}",
-      "paths": ["/{index}/{type}/{id}", "/{index}/{type}/{id}/_source"],
+      "paths": ["/{index}/{type}/{id}"],
       "parts": {
         "id": {
           "type" : "string",

+ 0 - 18
src/test/java/org/elasticsearch/test/rest/spec/RestApi.java

@@ -23,7 +23,6 @@ import com.google.common.collect.Maps;
 import org.apache.http.client.methods.HttpPost;
 import org.apache.http.client.methods.HttpPut;
 
-import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -50,23 +49,6 @@ public class RestApi {
         this.name = name;
     }
 
-    RestApi(RestApi restApi, String name, String... methods) {
-        this(restApi, name, restApi.getPaths(), Arrays.asList(methods));
-    }
-
-    RestApi(RestApi restApi, List<String> paths) {
-        this(restApi, restApi.getName(), paths, restApi.getMethods());
-    }
-
-    private RestApi(RestApi restApi, String name, List<String> paths, List<String> methods) {
-        this.name = name;
-        this.paths.addAll(paths);
-        this.methods.addAll(methods);
-        this.pathParts.addAll(restApi.getPathParts());
-        this.params.addAll(restApi.getParams());
-        this.body = restApi.body;
-    }
-
     public String getName() {
         return name;
     }

+ 1 - 15
src/test/java/org/elasticsearch/test/rest/spec/RestSpec.java

@@ -18,7 +18,6 @@
  */
 package org.elasticsearch.test.rest.spec;
 
-import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import org.elasticsearch.common.xcontent.XContentParser;
 import org.elasticsearch.common.xcontent.json.JsonXContent;
@@ -27,7 +26,6 @@ import org.elasticsearch.test.rest.support.FileUtils;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
-import java.util.List;
 import java.util.Map;
 
 /**
@@ -40,19 +38,7 @@ public class RestSpec {
     }
 
     void addApi(RestApi restApi) {
-        if ("get".equals(restApi.getName())) {
-            //TODO get_source endpoint shouldn't be present in the rest spec for the get api
-            //as get_source is already a separate api
-            List<String> paths = Lists.newArrayList();
-            for (String path : restApi.getPaths()) {
-                if (!path.endsWith("/_source")) {
-                    paths.add(path);
-                }
-            }
-            restApiMap.put(restApi.getName(), new RestApi(restApi, paths));
-        } else {
-            restApiMap.put(restApi.getName(), restApi);
-        }
+        restApiMap.put(restApi.getName(), restApi);
     }
 
     public RestApi getApi(String api) {