I have a problem in my YAML syntax. My response in JSON is like this:
{
"wordtxtword": "καρδιολόγος",
"relations": [
{
"relation": "treats",
"related_words": [
"έμφραγμα",
"στηθάγχη",
"στενοκαρδία",
"μυοκαρδίτιδα",
"ταχυκαρδία",
"ταχυπαλμία",
"ταχυσφυγμία",
"βραδυκαρδία",
"βραδυσφυγμία"
] },
{
"relation": "practices",
"related_words": [
"καρδιολογία"
] }
]
}
I need to write a YAML syntax covering this response. So my get is something like that:
get:
summary: Return a list of all related words.
description: |
This endpoint returns a list of all existing relations of the selected word. Results are grouped by the relation type.
tags:
- Word
responses:
200:
description: Multiple arrays of words according to the relation type they have with the word that is searched.
schema:
type: array
items:
$ref: '#/definitions/relationlist'
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
And in my definitions i have :
relationlist:
type: object
properties:
wordtxt:
type: string
description: The matching word as found in the dictionary.
relations:
type: object
description: An array of relation types and words that belong to that relation type.
properties:
relation:
type: string
description: The relation type
related_words:
type: object
properties:
words: string
My question is how to express the array of strings that corresponds to the 'related_words' field in my definition. The way i am now expressing it is not correct since there is no 'words' field in my JSON response.