我们已经升级到群发平台,现在正在创建API规范,这些规范使用MuleSoft推荐的片段。但是,我们可以导入RAML,但不能生成流。没有错误-没有警告-什么都没有。
我已经包含了一个示例。
api.raml
#%RAML 1.0
version: v1
title: api
types:
contactDetails: !include library/types/contactDetails.raml
/contact:
post:
body:
application/json:
type: contactDetailstypes-library.raml
#%RAML 1.0 Library
types:
telephoneNumber: !include ../exchange_modules/fragment-flows-problem-fragment/1.0.0/telephone-number.ramlcontactDetails.raml
#%RAML 1.0 DataType
uses:
contactDetails: ../types-library.raml
properties:
name:
type: string
telephone:
type: contactDetails.telephoneNumber电话号码.raml(片段)
#%RAML 1.0 DataType
description: |
**includes validation applicable to a contact telephone number**
***
- Minimum length 9
- Maximum length 15
type: string
displayName: Telephone Number
minLength: 9
maxLength: 15
pattern: ^[\d ]+$
examples:
telephoneNumber1: "01433000000"
telephoneNumber2: "01433 000000"我要补充的是,RAML在设计中心和Exchange中都是有效的。
另外,如果我们删除contactDetails.raml中的uses语句,那么contactDetails数据类型将无法识别。
如果有人在这里指出一个问题,或者解释Anypoint Studio如何导入使用片段的规范,这将是非常有用的。
谢谢。
发布于 2018-11-03 04:30:30
这是一个迟来的回复,但我今天碰巧遇到了这个问题,我的搜索引导我找到了你的问题。
对我来说,问题是contactDetails.raml文件中缺少一个!include。我在Anypoint Studio中也遇到了同样的问题,我的解决方法是:
#%RAML 1.0 DataType
uses:
contactDetails: !include ../types-library.raml
properties:
name:
type: string
telephone:
type: contactDetails.telephoneNumber不幸的是,Anypoint Studio并没有给出任何关于为什么会出现RAML错误的好信息,而只是告诉你出了什么问题。
https://stackoverflow.com/questions/51086196
复制相似问题