use of com.google.api.server.spi.config.ApiConfigInconsistency in project endpoints-java by cloudendpoints.
the class ApiConfigValidator method validate.
/**
* Validates all configurations for a single API. Makes sure the API-level configuration matches
* for all classes and that the contained configuration is valid and can be turned into a *.api
* file. Only checks for swarm-specific validity. Apiary FE may still dislike a config for its
* own reasons.
*
* @throws ApiConfigInvalidException on any invalid API-wide configuration.
* @throws ApiClassConfigInvalidException on any invalid API class configuration.
* @throws ApiMethodConfigInvalidException on any invalid API method configuration.
* @throws ApiParameterConfigInvalidException on any invalid API parameter configuration.
*/
public void validate(Iterable<? extends ApiConfig> apiConfigs) throws ApiConfigInvalidException, ApiClassConfigInvalidException, ApiMethodConfigInvalidException, ApiParameterConfigInvalidException {
if (Iterables.isEmpty(apiConfigs)) {
return;
}
Map<String, ApiMethodConfig> restfulSignatures = Maps.newHashMap();
Iterator<? extends ApiConfig> i = apiConfigs.iterator();
ApiConfig first = i.next();
validate(first, restfulSignatures);
while (i.hasNext()) {
ApiConfig config = i.next();
Iterable<ApiConfigInconsistency<Object>> inconsistencies = config.getConfigurationInconsistencies(first);
if (!Iterables.isEmpty(inconsistencies)) {
throw new InconsistentApiConfigurationException(config, first, inconsistencies);
}
validate(config, restfulSignatures);
}
}
Aggregations