首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >RAML码理解

RAML码理解
EN

Stack Overflow用户
提问于 2017-12-09 04:07:26
回答 1查看 396关注 0票数 0

我对simple RAML的设计要求很低。我是RAML编码的新手,所以想知道我的代码是否符合要求

要求:

  • 具有至少一个带有GET和POST方法的端点。
  • 包括API的说明属性。
  • 包括方法的描述属性。
  • GET请求接受一个查询参数"mulesoft“
  • 使用至少包含字符串和整数数据类型的对象定义响应。
  • 包含与上面定义的响应对象匹配的200个响应代码的示例

我的代码:

代码语言:javascript
复制
#%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"
                }                    

我更关心的是要求中的一个要点

代码语言:javascript
复制
"The GET request takes a query parameter of “mulesoft”

这是否意味着我应该在我的mulesoft中动态地给出url作为参数,如果是的话,那么除了mulesoft作为参数传递,它应该抛出一个错误?

(或)

这是否意味着我需要像现在这样在我的“mulesoft”代码中硬编码RAML

你能帮我澄清一下吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-12-09 05:46:36

这是否意味着我需要像现在这样在我的RAML代码中硬编码“mulesoft”?

Yes.You应该在RAML中定义它所需的参数now.Since,可以在实现中验证它的存在。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47725230

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档