Ask a Question

Nestjs/swagger how to write nested properties with arrays?

mhosan
New Member

Nestjs/swagger how to write nested properties with arrays?

How to write a Class with this? : 
movements:
          type: array
          items:
            type: object
            properties:
              merchant_name:
                description: Merchant's name
                type: string
                example: MERSARQRT Mi&CO
              merchant_code:
                type: string
                example: MER003
              amount:
                example: 100.01
                type: number
                format: double
1 REPLY 1
ponelat
Staff

Hi @mhosan ,

 

Not sure I understand, do you mean to have an object that contains the property `movements`and the schema you've already described? 

If so, you've got most of it, see: https://app.swaggerhub.com/apis/SwaggerPMTests/nested-array-item/1.0.0

 

And see https://swagger.io/docs/specification/data-models/ for more info.

cancel
Showing results for 
Search instead for 
Did you mean: