Introduces validation to restrict API's to single namespace (#51982)

To be merged after #51981 lands

(cherry picked from commit 196eaf8ac1ccc777f5bd81469d1148bc7ec299dd)
This commit is contained in:
Martijn Laarman 2020-02-06 17:15:46 +01:00
parent 898dd0b9cc
commit f626700757
1 changed files with 3 additions and 0 deletions

View File

@ -47,6 +47,9 @@ public class ClientYamlSuiteRestApiParser {
if (location.endsWith(apiName + ".json") == false) {
throw new IllegalArgumentException("API [" + apiName + "] should have the same name as its file [" + location + "]");
}
if (apiName.chars().filter(c -> c == '.').count() > 1) {
throw new IllegalArgumentException("API [" + apiName + "] contains more then one namespace [" + location + "]");
}
ClientYamlSuiteRestApi restApi = new ClientYamlSuiteRestApi(location, apiName);