我正在为我的一个项目创建一个RAML,我有一个案例,其中一个API有一个DTO类型的查询参数。那么,我该如何编写示例和" Type"那个查询参数?
QueryParam:
description: Some description.
type: DTO
required: true
example: ??
答案 0 :(得分:0)
查询参数只能是primitive type
#%RAML 0.8
title: GitHub API
version: v3
baseUri: https://api.github.com/{version}
/users:
get:
description: Get a list of users
queryParameters:
page:
description: Specify the page that you want to retrieve
type: integer
required: true
example: 1
请求/响应主体可以使用json,在这种情况下,类型是json schema,示例是json:
/jobs:
displayName: Jobs
post:
description: Create a Job
body:
application/json:
schema: |
{
"$schema": "http://json-schema.org/draft-03/schema",
"properties": {
"input": {
"required": false,
"type": "string"
}
},
"required": false,
"type": "object"
}
example: { "input": "foo" }