我对simple RAML的设计要求很低。我是RAML编码的新手,所以想知道我的代码是否符合要求
要求:
我的代码:
#%RAML 1.0
title: Coding_Champions
version: 1.0.development
baseUri: http://localhost:8004/api
description: This API displays and adds Organisation with details
types:
Org:
type: object
properties:
name: string
address: string
pincode: integer
/details:
displayName: Company Details
description: Coding challenge which takes query parameter of "mulesoft"
get:
description: Retrieve a list of all the Orgs
queryParameters:
mulesoft:
description: Specify the Org name that you want to retrieve
type: boolean
required: true
responses:
200:
body:
application/json:
type: Org
examples:
MuleSoft:
name: MuleSoft
address: 77 Geary Street, Suite 400
pincode: 94108
post:
description: Add a Org to list
body:
application/json:
type: Org
examples:
Cognizant:
name: Cognizant
address: DLF
pincode: 9771
responses:
201:
body:
application/json:
example: |
{
"message":"New Org updated but not really"
} 我更关心的是要求中的一个要点
"The GET request takes a query parameter of “mulesoft”这是否意味着我应该在我的mulesoft中动态地给出url作为参数,如果是的话,那么除了mulesoft作为参数传递,它应该抛出一个错误?
(或)
这是否意味着我需要像现在这样在我的“mulesoft”代码中硬编码RAML?
你能帮我澄清一下吗?
发布于 2017-12-09 05:46:36
这是否意味着我需要像现在这样在我的RAML代码中硬编码“mulesoft”?
Yes.You应该在RAML中定义它所需的参数now.Since,可以在实现中验证它的存在。
https://stackoverflow.com/questions/47725230
复制相似问题