我尝试验证linkedin.raml,但由于某种原因,我得到了以下一组验证错误。
[2015-10-07 00:09:46,776] ERROR {org.wso2.carbon.registry.custom.extensions.handlers.utils.RAMLProcessor} - Invalid value type
[2015-10-07 00:09:46,778] WARN {org.wso2.carbon.registry.custom.extensions.handlers.utils.RAMLProcessor} - schema can not be empty
[2015-10-07 00:09:46,778] ERROR {org.wso2.carbon.registry.custom.extensions.handlers.utils.RAMLProcessor} - invalid JSON schema: no JSON Text to read from input
[2015-10-07 00:09:46,778] WARN {org.wso2.carbon.registry.custom.extensions.handlers.utils.RAMLProcessor} - example can not be empty
[2015-10-07 00:09:46,778] WARN {org.wso2.carbon.registry.custom.extensions.handlers.utils.RAMLProcessor} - schema can not be empty
[2015-10-07 00:09:46,778] ERROR {org.wso2.carbon.registry.custom.extensions.handlers.utils.RAMLProcessor} - invalid JSON schema: no JSON Text to read from input
[2015-10-07 00:09:46,778] WARN {org.wso2.carbon.registry.custom.extensions.handlers.utils.RAMLProcessor} - example can not be empty
[2015-10-07 00:09:46,778] WARN {org.wso2.carbon.registry.custom.extensions.handlers.utils.RAMLProcessor} - schema can not be empty
[2015-10-07 00:09:46,778] ERROR {org.wso2.carbon.registry.custom.extensions.handlers.utils.RAMLProcessor} - invalid JSON schema: no JSON Text to read from input
[2015-10-07 00:09:46,778] WARN {org.wso2.carbon.registry.custom.extensions.handlers.utils.RAMLProcessor} - example can not be empty
[2015-10-07 00:09:46,778] WARN {org.wso2.carbon.registry.custom.extensions.handlers.utils.RAMLProcessor} - schema can not be empty
...
下面是我用来验证 RAML 的代码片段
private boolean isValidRAML(String sourceUrl) {
boolean isNoError = true;
List<ValidationResult> results = RamlValidationService.createDefault().validate(sourceUrl);
Iterator<ValidationResult> resultsIterator = results.iterator();
while (resultsIterator.hasNext()) {
ValidationResult valResult = resultsIterator.next();
String resultLevel = valResult.getLevel().toString();
String resultMessage = valResult.getMessage();
if (CommonConstantsRAML.ERROR_PARAMETER_NAME.equals(resultLevel)) {
log.error(resultMessage);
isNoError = false;
} else if (CommonConstantsRAML.WARN_PARAMETER_NAME.equals(resultLevel)) {
log.warn(resultMessage);
}
}
return isNoError;
}
这是预期的吗?如果不是,是什么原因造成的?如需更多参考,请查找我在我的轨道包中使用的一组 mvn 依赖项。
<dependencies>
<dependency>
<groupId>org.raml</groupId>
<artifactId>raml-parser</artifactId>
<version>0.8.11</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
<exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.logging</artifactId>
<version>4.2.0</version>
</dependency>
</dependencies>
显然在行号的linkedin.raml :178 中导致了这个问题。为什么是这样?
175:settings:
176: authorizationUri: https://www.linkedin.com/uas/oauth2/authorization
177: accessTokenUri: https://www.linkedin.com/uas/oauth2/accessToken
178: authorizationGrants: code