【发布时间】:2018-02-26 06:21:17
【问题描述】:
我正在将 json 转换为 raml ,以便 /alert/ 它得到正确的响应,但对于 /alert/{alertid},它没有得到响应。我想要特定 alertId API 的响应。这是我的 raml 代码。警报中有很多 id 我想要响应特定的 id 。对于特定的 id,我正在使用 API。
#%RAML 1.0
title: Test the load customer REST Services
version: 1.0
protocols: [ HTTPS ]
baseUri: http://myapi.mysite.com/api/
mediaType: application/json
securitySchemes:
basicAuth:
description: Each request must contain the header
type: Basic Authentication
describedBy:
headers:
Authorization:
description: Used to send
type: string
responses:
401:
description: |
Provided username and password is invalid.
types:
alert:
type: object
properties:
id: string
description: string
assetId: string
alertId: string
code: integer
ownerId?: string
metadata:
type: object
properties:
indicatorId: string
types:
837a-dcf2a7d556c5:
type: object
properties:
id: string
description: string
assetId: string
alertId: string
code: integer
ownerId?: string
metadata:
type: object
properties:
indicatorId: string
/alert:
get:
description: Get list of alert API.
headers:
body:
responses:
200:
body:
type: !include alert.json
/{alertId}:
get:
description: Get list of by Id.
headers:
body:
responses:
200:
body:
type: !include 837a-dcf2a7d556c5.json
【问题讨论】:
-
你的意思是它没有响应?此外,您不能两次声明类型,请删除第二次声明。为什么你在类型中使用 json 包含而不是使用你指定的 RAML 类型?
标签: javascript jquery json swagger raml