RAML代码理解

RAML Code understanding

我有以下设计要求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”

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

(或)

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

你能澄清一下吗?

Does it mean I need to hard code “mulesoft” in my RAML code as I have done now ?

Yes.You 应该在 RAML 中定义它,因为你做对了 now.Since 它所需的参数,它的存在可以在实现中得到验证。