Mule #带骡子的RAML中的ref(apikit)

Mule #带骡子的RAML中的ref(apikit),mule,raml,Mule,Raml,我们正在使用Mule 3.7 CE。在Maven POM中,我们使用apikit 1.7.3。我们还使用raml for jax rs生成基于raml的java代码 我们试图做的是在代码方面使用一个公共对象,而在raml/jsonschema方面则引用其他各种模式可以使用的公共模式 mule流使用apikit和到以下RAML的链接(只是一个示例): 现在的问题是,在运行时执行POST时会出现以下错误: ERROR 2016-02-29 15:45:52,755 [[testraml].test

我们正在使用Mule 3.7 CE。在Maven POM中,我们使用apikit 1.7.3。我们还使用raml for jax rs生成基于raml的java代码

我们试图做的是在代码方面使用一个公共对象,而在raml/jsonschema方面则引用其他各种模式可以使用的公共模式

mule流使用apikit和到以下RAML的链接(只是一个示例):

现在的问题是,在运行时执行POST时会出现以下错误:

 ERROR 2016-02-29 15:45:52,755 [[testraml].test-httpListenerConfig.worker.01] org.mule.module.apikit.MappingExceptionListener: 
********************************************************************************
Message               : fatal: URI "addressbook#" is not absolute
    level: "fatal"
    uri: "addressbook#"
 (com.github.fge.jsonschema.core.exceptions.ProcessingException)
Type                  : org.mule.module.apikit.exception.BadRequestException
Code                  : MULE_ERROR--2
JavaDoc               : http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/module/apikit/exception/BadRequestException.html
********************************************************************************
Exception stack is:
1. fatal: URI "addressbook#" is not absolute
    level: "fatal"
    uri: "addressbook#"
 (com.github.fge.jsonschema.core.exceptions.ProcessingException)
  com.github.fge.jsonschema.core.load.SchemaLoader:163 (null)
2. fatal: URI "addressbook#" is not absolute
    level: "fatal"
    uri: "addressbook#"
 (com.github.fge.jsonschema.core.exceptions.ProcessingException) (org.mule.module.apikit.exception.BadRequestException)
  org.mule.module.apikit.validation.RestJsonSchemaValidator:95 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/module/apikit/exception/BadRequestException.html)
********************************************************************************
Root Exception stack trace:
com.github.fge.jsonschema.core.exceptions.ProcessingException: fatal: URI "addressbook#" is not absolute
    level: "fatal"
    uri: "addressbook#"

    at com.github.fge.jsonschema.core.load.SchemaLoader.get(SchemaLoader.java:163)
    at com.github.fge.jsonschema.core.load.RefResolver.rawProcess(RefResolver.java:114)
    at com.github.fge.jsonschema.core.load.RefResolver.rawProcess(RefResolver.java:51)
    at com.github.fge.jsonschema.core.processing.RawProcessor.process(RawProcessor.java:77)
    at com.github.fge.jsonschema.core.processing.RawProcessor.process(RawProcessor.java:41)
    at com.github.fge.jsonschema.core.processing.ProcessorChain$ProcessorMerger.process(ProcessorChain.java:189)
    at com.github.fge.jsonschema.core.processing.ProcessingResult.of(ProcessingResult.java:79)
    at com.github.fge.jsonschema.core.processing.CachingProcessor$1.load(CachingProcessor.java:128)
    at com.github.fge.jsonschema.core.processing.CachingProcessor$1.load(CachingProcessor.java:120)
    at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)
    at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319)
    at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282)
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197)
    at com.google.common.cache.LocalCache.get(LocalCache.java:3937)
    at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941)
    at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824)
    at com.github.fge.jsonschema.core.processing.CachingProcessor.process(CachingProcessor.java:109)
    at com.github.fge.jsonschema.processors.validation.ValidationChain.process(ValidationChain.java:107)
    at com.github.fge.jsonschema.processors.validation.ValidationChain.process(ValidationChain.java:57)
    at com.github.fge.jsonschema.core.processing.ProcessorMap$Mapper.process(ProcessorMap.java:166)
    at com.github.fge.jsonschema.core.processing.ProcessingResult.of(ProcessingResult.java:79)
    at com.github.fge.jsonschema.core.processing.CachingProcessor$1.load(CachingProcessor.java:128)
    at com.github.fge.jsonschema.core.processing.CachingProcessor$1.load(CachingProcessor.java:120)
    at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)
    at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319)
    at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282)
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197)
    at com.google.common.cache.LocalCache.get(LocalCache.java:3937)
    at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941)
    at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824)
    at com.github.fge.jsonschema.core.processing.CachingProcessor.process(CachingProcessor.java:109)
    at com.github.fge.jsonschema.processors.validation.InstanceValidator.process(InstanceValidator.java:136)
    at com.github.fge.jsonschema.processors.validation.InstanceValidator.processObject(InstanceValidator.java:241)
    at com.github.fge.jsonschema.processors.validation.InstanceValidator.process(InstanceValidator.java:176)
    at com.github.fge.jsonschema.processors.validation.ValidationProcessor.process(ValidationProcessor.java:56)
    at com.github.fge.jsonschema.processors.validation.ValidationProcessor.process(ValidationProcessor.java:34)
    at com.github.fge.jsonschema.core.processing.ProcessingResult.of(ProcessingResult.java:79)
    at com.github.fge.jsonschema.main.JsonSchema.doValidate(JsonSchema.java:76)
    at com.github.fge.jsonschema.main.JsonSchema.validate(JsonSchema.java:109)
    at com.github.fge.jsonschema.main.JsonSchema.validate(JsonSchema.java:125)
    at org.mule.module.apikit.validation.RestJsonSchemaValidator.validate(RestJsonSchemaValidator.java:73)
    at org.mule.module.apikit.HttpRestRequest.validateSchema(HttpRestRequest.java:413)
    at org.mule.module.apikit.HttpRestRequest.valideateBody(HttpRestRequest.java:312)
    at org.mule.module.apikit.HttpRestRequest.negotiateInputRepresentation(HttpRestRequest.java:289)
    at org.mule.module.apikit.HttpRestRequest.validate(HttpRestRequest.java:114)
    at org.mule.module.apikit.AbstractRouter.processRouterRequest(AbstractRouter.java:193)
    at org.mule.module.apikit.AbstractRouter.processBlockingRequest(AbstractRouter.java:89)
    at org.mule.module.apikit.AbstractRouter.processBlocking(AbstractRouter.java:83)
    at org.mule.processor.AbstractRequestResponseMessageProcessor.process(AbstractRequestResponseMessageProcessor.java:47)
    at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24)
    at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:107)
    at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
    at org.mule.processor.BlockingProcessorExecutor.executeNext(Blocking...
********************************************************************************
从ramlforjax-rs生成的代码看起来不错。我们得到了TestInput1和TestInput2使用的一个Addressbook对象

我们确实找到了一张jira票证,上面说它是在1.7.3中修复的(我们在POM中使用)。据我们所知,这个问题似乎仍然没有得到解决,因为从RAML角度看,这个看起来不错,从代码角度看,它看起来不错,但是使用RAML-with-API工具包会出现错误

那么我们做错什么了吗?这还是一个bug吗?我们需要等骡子3.8吗?有工作吗?我们在概念层面上做错了吗


也在旁注上;查看APIkit控制台会完整显示引用,而不是描述引用。这样,外部开发人员就不知道方案的上下文是什么。有什么解决方法吗?

我记得我使用了一个自定义JSON验证器来调用JSON模式,但这里的例子是引用不同模式中的对象并生成多个模式

您可以创建多个模式文件,然后使用raml!包括?说!包括sampleschema.json

然后检查链接:

这里有一个章节:

“磅符号(#)指的是当前文档,然后斜杠(/)分隔的键只遍历文档中对象中的键。因此,在我们的示例中,#/definitions/address”表示:

转到文档的根目录 查找键“定义”的值 在该对象中,找到键“address”的值 $ref也可以是相对或绝对URI,因此如果您希望将定义包含在单独的文件中,也可以这样做。例如:


{“$ref”:“definitions.json#/address”}”

尝试并检查此链接:感谢链接。然而,我以前看过这篇文章。正如您在我发布的示例中所看到的,我使用了#ref。目前RAML 1.0还不是一个选项,因为RAML for jax rs还不支持RAML 1.0。此外,如果没有弄错的话,RAML 1.0对描述对象的使用并不像jsonschema那样完整。
 ERROR 2016-02-29 15:45:52,755 [[testraml].test-httpListenerConfig.worker.01] org.mule.module.apikit.MappingExceptionListener: 
********************************************************************************
Message               : fatal: URI "addressbook#" is not absolute
    level: "fatal"
    uri: "addressbook#"
 (com.github.fge.jsonschema.core.exceptions.ProcessingException)
Type                  : org.mule.module.apikit.exception.BadRequestException
Code                  : MULE_ERROR--2
JavaDoc               : http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/module/apikit/exception/BadRequestException.html
********************************************************************************
Exception stack is:
1. fatal: URI "addressbook#" is not absolute
    level: "fatal"
    uri: "addressbook#"
 (com.github.fge.jsonschema.core.exceptions.ProcessingException)
  com.github.fge.jsonschema.core.load.SchemaLoader:163 (null)
2. fatal: URI "addressbook#" is not absolute
    level: "fatal"
    uri: "addressbook#"
 (com.github.fge.jsonschema.core.exceptions.ProcessingException) (org.mule.module.apikit.exception.BadRequestException)
  org.mule.module.apikit.validation.RestJsonSchemaValidator:95 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/module/apikit/exception/BadRequestException.html)
********************************************************************************
Root Exception stack trace:
com.github.fge.jsonschema.core.exceptions.ProcessingException: fatal: URI "addressbook#" is not absolute
    level: "fatal"
    uri: "addressbook#"

    at com.github.fge.jsonschema.core.load.SchemaLoader.get(SchemaLoader.java:163)
    at com.github.fge.jsonschema.core.load.RefResolver.rawProcess(RefResolver.java:114)
    at com.github.fge.jsonschema.core.load.RefResolver.rawProcess(RefResolver.java:51)
    at com.github.fge.jsonschema.core.processing.RawProcessor.process(RawProcessor.java:77)
    at com.github.fge.jsonschema.core.processing.RawProcessor.process(RawProcessor.java:41)
    at com.github.fge.jsonschema.core.processing.ProcessorChain$ProcessorMerger.process(ProcessorChain.java:189)
    at com.github.fge.jsonschema.core.processing.ProcessingResult.of(ProcessingResult.java:79)
    at com.github.fge.jsonschema.core.processing.CachingProcessor$1.load(CachingProcessor.java:128)
    at com.github.fge.jsonschema.core.processing.CachingProcessor$1.load(CachingProcessor.java:120)
    at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)
    at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319)
    at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282)
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197)
    at com.google.common.cache.LocalCache.get(LocalCache.java:3937)
    at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941)
    at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824)
    at com.github.fge.jsonschema.core.processing.CachingProcessor.process(CachingProcessor.java:109)
    at com.github.fge.jsonschema.processors.validation.ValidationChain.process(ValidationChain.java:107)
    at com.github.fge.jsonschema.processors.validation.ValidationChain.process(ValidationChain.java:57)
    at com.github.fge.jsonschema.core.processing.ProcessorMap$Mapper.process(ProcessorMap.java:166)
    at com.github.fge.jsonschema.core.processing.ProcessingResult.of(ProcessingResult.java:79)
    at com.github.fge.jsonschema.core.processing.CachingProcessor$1.load(CachingProcessor.java:128)
    at com.github.fge.jsonschema.core.processing.CachingProcessor$1.load(CachingProcessor.java:120)
    at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)
    at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319)
    at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282)
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197)
    at com.google.common.cache.LocalCache.get(LocalCache.java:3937)
    at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941)
    at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824)
    at com.github.fge.jsonschema.core.processing.CachingProcessor.process(CachingProcessor.java:109)
    at com.github.fge.jsonschema.processors.validation.InstanceValidator.process(InstanceValidator.java:136)
    at com.github.fge.jsonschema.processors.validation.InstanceValidator.processObject(InstanceValidator.java:241)
    at com.github.fge.jsonschema.processors.validation.InstanceValidator.process(InstanceValidator.java:176)
    at com.github.fge.jsonschema.processors.validation.ValidationProcessor.process(ValidationProcessor.java:56)
    at com.github.fge.jsonschema.processors.validation.ValidationProcessor.process(ValidationProcessor.java:34)
    at com.github.fge.jsonschema.core.processing.ProcessingResult.of(ProcessingResult.java:79)
    at com.github.fge.jsonschema.main.JsonSchema.doValidate(JsonSchema.java:76)
    at com.github.fge.jsonschema.main.JsonSchema.validate(JsonSchema.java:109)
    at com.github.fge.jsonschema.main.JsonSchema.validate(JsonSchema.java:125)
    at org.mule.module.apikit.validation.RestJsonSchemaValidator.validate(RestJsonSchemaValidator.java:73)
    at org.mule.module.apikit.HttpRestRequest.validateSchema(HttpRestRequest.java:413)
    at org.mule.module.apikit.HttpRestRequest.valideateBody(HttpRestRequest.java:312)
    at org.mule.module.apikit.HttpRestRequest.negotiateInputRepresentation(HttpRestRequest.java:289)
    at org.mule.module.apikit.HttpRestRequest.validate(HttpRestRequest.java:114)
    at org.mule.module.apikit.AbstractRouter.processRouterRequest(AbstractRouter.java:193)
    at org.mule.module.apikit.AbstractRouter.processBlockingRequest(AbstractRouter.java:89)
    at org.mule.module.apikit.AbstractRouter.processBlocking(AbstractRouter.java:83)
    at org.mule.processor.AbstractRequestResponseMessageProcessor.process(AbstractRequestResponseMessageProcessor.java:47)
    at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24)
    at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:107)
    at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
    at org.mule.processor.BlockingProcessorExecutor.executeNext(Blocking...
********************************************************************************