Forum Discussion

HenrikHL's avatar
HenrikHL
Frequent Contributor
2 years ago

Restrict string lengths in arrays

Hi,

I was wondering if it is possible to restrict length of strings in arrays? I have the following structure:

shippingMarks:
  type: array
  minItems: 1
  description: 'List of `ShippingMarks`...'
  example: ['Made in China']
  items:
    type: string

This would allow the following:

shippingMarks: ['Made in China']

 

I would like to limit the maxLength of the strings inserted into the array - how is this done?