Forum Discussion

lia's avatar
lia
New Contributor
2 years ago

Dictionaries mapping strings to Array?

Hello, you all. I aim to generate the spec through a NestJS project, and It's all working until now. The problem arises when I want to specify that return data is a Dict that maps a key to an array o...
  • ponelat's avatar
    2 years ago

    Hi lia ,

     

    You were very close, there isn't a "isArray" flag but there is an "array" type. See the following example...

    components:
      schemas:
        CustomMap:
          type: object
          additionalProperties:
            type: array
            items:
              $ref: '#/components/schemas/CustomObjectType'      
        CustomObjectType:
          type: object
    

     See: https://swagger.io/docs/specification/data-models/data-types/#array