2

現在、API を生成しようとしていますが、リスト グループ内の最初のメソッドの説明を追加するのに苦労しています。最初のメソッドだけでなく、グループ内の他のすべてのメソッドの説明を追加できます。

どのように表示するかを示す画像を下に添付しましたが、RAMLtoHTML ジェネレーターを使用してこれを実現することはできません。

説明 問題

以下は、メインファイルで使用しているコードです。このファイルには、私が問題を抱えているファイルのインクルードがあります。私はそれで何かを変えることができるかもしれないと思っていましたか?

#%RAML 0.8
title: Hubs
baseUri: https://apis.3dissue.com/hubsdashboard/api/{version}
version: v1
mediaType: application/json
documentation:
  - title: Getting Started
    content: !include md/getting_started.md
  - title: Overview
    content: !include md/overview.md
  - title: Creating a Hub
    content: !include md/creating_hub.md
  - title: Adding Social Sources to a Hub
    content: !include md/social_sources.md
  - title: Adding an Article to a Hub
    content: !include md/articles.md
traits: !include traits.raml


#Hubs
/hubs: !include calls/hubs.raml

これは、以下に説明を追加したいファイルです。ご覧のとおり、既にリストの説明を追加しています。ここにメソッドの説明を追加しようとすると、「説明」が既に定義されているという苦情がパーサーから返されます。

is: [appkey]
displayName: User Hubs
description: This group contains methods that will allow you to create, manage, and retrieve details of one or more hubs.
get:
  description: Returns a JSON array containing details of hubs associated with the user account.
  queryParameters:
    page:
      description: The page number to be returned within the paged results. By default, this will return the first page.
      type: number
      default: 1
    page_size:
      description: The number of elements to return per page. By default, a total of 10 elements will be returned. This parameter should be used in combination with the page parameter for setting up paged results.
      type: number
      default: 10
    related:
      description: Determines whether to return related objects. If set to 1, all child elements for each hub in the list will be returned including any sections and sources.
      type: boolean
      default: 0
  body:
    example: !include ../php/getListOfHubs.php
  responses:
    200:
      body:
        application/json:
          example: !include ../json/hubs.json
post:
  description: This method will allow you to create a new hub.
  body:
      example: !include ../php/createHub.php
  responses:
    200:
      body:
        application/json:
          example: !include ../json/hub_create_response.json
/{hub_id}:
  description: The following methods can be used to manage or retrieve details for a given hub.
  uriParameters:
    hub_id:
      description: A string value used to uniquely identify a hub.
      type: string
  get:
    description: Returns a JSON array containing details for the given hub.
    body:
      example: !include ../php/getHub.php
    responses:
      200:
        body:
          application/json:
            example: !include ../json/hub.json
  put:
    description: This method will allow you to update the display name of the given hub.
    body:
      example: !include ../php/updateHub.php
    responses:
      200:
        body:
          application/json:
            example: !include ../json/hub.json
  delete:
    description: This method will allow you to delete the selected hub. Deleting a hub will not remove any sources from your account.
    body:
      example: !include ../php/deleteHub.php
    responses:
      204:
        description: No response body

これに対する回避策はありますか?インクルードの前に最初のファイル内に説明を追加しようとしましたが、パーサー エラーが発生します。/hubs 宣言を 2 番目のファイル内に移動しようとしましたが、それを解析できる唯一の方法は、メソッド呼び出し URL に余分な文字を追加することです。これは理想とはほど遠いものです。

4

0 に答える 0