connexion icon indicating copy to clipboard operation
connexion copied to clipboard

Add more parameter validation on type:array

Open chimeno opened this issue 7 years ago • 3 comments

Description

When using a parameter like:

  dow:
    name: dow
    description: An array of days of the week (0 - 6)
    in: query
    required: true
    type: array
    items:
      type: integer
      minimum: 0
      maximum: 6
      maxItems: 7
      minItems: 1
    collectionFormat: csv

Validation doesn't occur given the properties (minimum, maximum, maxItems, minItems) that are in the https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#itemsObject

Expected behaviour

Validation on that properties should exists

Actual behaviour

Validation doesn't occur

Additional info:

Output of the commands:

  • python: 3.6.1
  • connexion=1.1.15

chimeno avatar Sep 21 '17 11:09 chimeno

Thanks for reporting this @chimeno .. Would you be willing to provide a fix for this in the form of a PR? If you're not willing, could you provide a more complete example on how to reproduce this?

mvalkon avatar Sep 22 '17 12:09 mvalkon

It looks like it was added back in #39? However, when I attempt to add minItems to an array type in my swagger.yaml and I run

java -jar ~/swagger-codegen/swagger-codegen-cli-2.2.3.jar generate \
  -i swagger_server/swagger/swagger.yaml \
  -l python-flask \
  -o ./

nothing is generated and my changes to swagger.yaml are reverted.

  • python: 3.6.1
  • connextion: 1.1.9

dcarrot2 avatar Oct 11 '17 22:10 dcarrot2

This is still present in Connexion 2.7.0. I was trying to use minItems in an array and no validation error is issued when the array does not meet the specification.

roo-oliv avatar Dec 07 '20 18:12 roo-oliv