summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgarren smith <garren.smith@gmail.com>2021-03-31 10:39:55 +0200
committergarren smith <garren.smith@gmail.com>2021-04-06 10:29:50 +0200
commitd568be8b9f2e5c82846e731748d90bd295f3b70e (patch)
tree4fe9b343e4eecd272d2fd5589268848e886c8edf
parent7b64af6514ded28b0bb67b2143fe78712d988994 (diff)
downloadcouchdb-validate-ddoc.tar.gz
remove couch_index_server:validatevalidate-ddoc
This makes it that the only way to validate a design doc is through couch_mrview:validate_ddoc so that the correct couch_eval will be used.
-rw-r--r--src/couch/src/couch_db.erl2
-rw-r--r--src/couch_index/src/couch_index_server.erl21
2 files changed, 2 insertions, 21 deletions
diff --git a/src/couch/src/couch_db.erl b/src/couch/src/couch_db.erl
index 60d2bb796..6587205a0 100644
--- a/src/couch/src/couch_db.erl
+++ b/src/couch/src/couch_db.erl
@@ -895,7 +895,7 @@ validate_doc_update(Db, Doc, GetDiskDocFun) ->
validate_ddoc(Db, DDoc) ->
try
- ok = couch_index_server:validate(Db, couch_doc:with_ejson_body(DDoc))
+ ok = couch_mrview:validate(Db, couch_doc:with_ejson_body(DDoc))
catch
throw:{invalid_design_doc, Reason} ->
{bad_request, invalid_design_doc, Reason};
diff --git a/src/couch_index/src/couch_index_server.erl b/src/couch_index/src/couch_index_server.erl
index 6bebff2d8..de2fa1c30 100644
--- a/src/couch_index/src/couch_index_server.erl
+++ b/src/couch_index/src/couch_index_server.erl
@@ -16,7 +16,7 @@
-vsn(2).
--export([start_link/0, validate/2, get_index/4, get_index/3, get_index/2]).
+-export([start_link/0, get_index/4, get_index/3, get_index/2]).
-export([init/1, terminate/2, code_change/3]).
-export([handle_call/3, handle_cast/2, handle_info/2]).
@@ -41,25 +41,6 @@ start_link() ->
gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
-validate(Db, DDoc) ->
- LoadModFun = fun
- ({ModNameList, "true"}) ->
- try
- [list_to_existing_atom(ModNameList)]
- catch error:badarg ->
- []
- end;
- ({_ModNameList, _Enabled}) ->
- []
- end,
- ValidateFun = fun
- (ModName) ->
- ModName:validate(Db, DDoc)
- end,
- EnabledIndexers = lists:flatmap(LoadModFun, config:get("indexers")),
- lists:foreach(ValidateFun, EnabledIndexers).
-
-
get_index(Module, <<"shards/", _/binary>> = DbName, DDoc)
when is_record(DDoc, doc) ->
get_index(Module, DbName, DDoc, nil);