type: object

properties:

                wordtxtword:

                                type string

                relations:

                                type: array

                                items:

                                                type: object

                                                properties:

                                                                relation:

                                                                                
type: string

                                                                related_words:

                                                                                
type: array

                                                                                
items:

                                                                                
                type: string

 

 

From: <[email protected]> on behalf of Νίκος Σιδηρόπουλος 
<[email protected]>
Reply-To: "[email protected]" 
<[email protected]>
Date: Thursday, 23 March 2017 at 1:06
To: Swagger <[email protected]>
Subject: YAML definition syntax when a field is an array

 

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.

 

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to