A
A
Anton Ivanov2016-04-11 02:56:37
API
Anton Ivanov, 2016-04-11 02:56:37

Is it possible in RAML to specify an associated type for a top-level resource?

Hello.
Learning RAML, writing API output myself, there is a need to do the following thing: when outputting the resource section of the documentation, output the type that is associated with each resource. That is, there is, for example, a /orders resource, I want the following output:
Orders (displayName)
then some description (description) then a
description of the Order type with parameters.
and then a description of all methods.
In the RAML specification, I did not find either a standard such possibility, or the ability to specify a custom field when describing a resource. Is it even possible?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Malikov, 2017-01-06
@malikov_a

Specifying a type on a resource is meaningless.
The variant with ResourceType works well:

/Organizations:
  type: collection-item
  /{guid}:
    type: item

item:
#%RAML 1.0 ResourceType

description: Элемент <<resourcePathName | !singularize>>
uriParameters:
  guid:
    pattern: |
      [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}
get:
  is: [secured]
  description: Получить элемент <<resourcePathName | !singularize>>
  responses:
    200:
      body:
        application/json:
          type: <<resourcePathName | !singularize>>
    404:
      description: Ресурс не найден

when outputting through the API console, the links work fine in RAML2HTML, I think it will also be displayed normally.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question