Map Types
Maps (aka Dictionaries) can be declared by creating an object type and declaring a special property called "[]":#%RAML 1.0 title: My API With Types types: MapOfNumbers: type: object properties: []: type: number
type: number
на type: string
. Посмотрите еще additionalProperties, из той же оперы. #%RAML 1.0
title: Example API
version: v1
types:
Dictonary_1:
type: array
items: string
Dictonary_item:
type: object
properties:
name:
type: string
value:
type: string
Dictonary_2:
type: array
items: Dictonary_item
/Dictonary_1:
post:
body:
application/json:
type: Dictonary_1
example: |
[
"item1",
"item2",
"item3"
]
/Dictonary_2:
post:
body:
application/json:
type: Dictonary_2
example: |
[
{
"name": "name1",
"value": "item1"
},
{
"name": "name2",
"value": "item2"
}
]