text raml文件的示例

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text raml文件的示例相关的知识,希望对你有一定的参考价值。

#%RAML 1.0
title: Booking Service
version: v1
baseUri: /

types:
  Booking:
    properties:
      city: string
      cinema: string
      movie: string
      schedule: datetime
      cinemaRoom: string
      seats: array
      totalAmount: number


  User:
    properties:
      name: string
      lastname: string
      email: string
      creditcard: object
      phoneNumber?: string
      membership?: number

  Ticket:
    properties:
      cinema: string
      schedule: string
      movie: string
      seat: string
      cinemaRoom: string
      orderId: string


resourceTypes:
  GET:
    get:
      responses:
        200:
          body:
            application/json:
              type: <<item>>

  POST:
    post:
      body:
        application/json:
          type: <<item>>
          type: <<item2>>
      responses:
        201:
          body:
            application/json:
              type: <<item3>>


/booking:
  type:   { POST: {item : Booking, item2 : User, item3: Ticket} }
  description: The booking service need a Booking object that contains all
    the needed information to make a purchase of cinema tickets.
    Needs a user information to make the booking succesfully.
    And returns a ticket object.

  /verify/{orderId}:
    type:  { GET: {item : Ticket} }
    description: This route is for verify orders, and would return all the details
      of a specific purchased by orderid.

以上是关于text raml文件的示例的主要内容,如果未能解决你的问题,请参考以下文章

如何在 RAML 中设置多个示例请求及其响应

RAML中基于查询参数的动态调用

从 RAML 文件生成 JSON 正文

在线提供示例 RAML [关闭]

RAML 1.0 - 单个响应的多个示例

RAML 中示例 json 的动态填充