mule - 您可以参考 RAML 中的示例和架构吗
问题描述
我正在使用 Mule 4 和 Anypoint Studio 7。
我目前正在编写 RAML,并希望将模式(验证)和示例(API 控制台中的模拟响应)添加到我的 RAML 中的资源,但我遇到了一般性错误。
#%RAML 1.0 Trait
responses:
200:
body:
application/json:
schema: mySchema
example: example/mySchema.json
是否可以对资源同时使用模式和示例?
谢谢
解决方案
这是一个例子
#%RAML 1.0
version: v1
title: something.raml
mediaType:
application/json
uses:
ResultsRS: path/StudentResultRS.raml
/students:
/results/get:
post:
description: get the results of a student
body:
application/json:
type: ResultsRS.tudentResultRS.raml
examples: !include path/examples/studentresults_RS.raml
您需要确保已正确定义类型和示例。
推荐阅读
- java - 方法声明无效?返回类型 必填?
- asp.net-core-mvc - MVC 和 Bootstrap 4:使用 DropDownListFor 更改生成的按钮标签的样式
- video - 通过 FFmpeg 将 RTP 流转换为 H.264
- android - 增加数据库中的值
- java - 如何将 GUI 项目始终设置在前面?
- xml - 从 VB.net 中的 XML 字符串获取数据
- java - 如何计算数组中两个字符的最大数量?
- java - 如何从从数据库中检索数据的 TCP 服务器将 JavaFX 表填充到 TCP 客户端
- javascript - 在输入中显示数据
- c++ - OpenGL 两屏