-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can not demand an array to be one or more items long #125
Comments
Well, this is an interesting problem. I tried adding this test way down at the validator level, and it passes, but I expected it to. I tried adding: /bug125:
post:
summary: minItems should work
# x-exegesis-controller: echoController.ts
# x-exegesis-operationId: echo
requestBody:
required: true
content:
'application/json':
schema:
type: object
properties:
articleIds:
type: array
uniqueItems: true
minItems: '1'
items:
type: string
details:
type: object
nullable: true
kind:
type: string
required:
- articleIds
- kind
responses:
'200':
description: Respond
content:
'application/json':
schema: { type: 'object' } to test/integration/openapi.yaml, and it passes too. In order to get your I just pushed 2.3.0, so I'd try upgrading to that. Maybe some package we depend on was updated by greenkeeper and magically fixed this. :) If that doesn't help, then generateValidator() is the function that's taking in your schema and passing it to ajv to generate a body validator function. So I'd start with a breakpoint there and see if bundle() would be another place to look - this is where we take in an OpenAPI object or a filename, and run it though I'm traveling for the next week (taking my daughter to Disney World for her birthday!) so I probably won't get back to you about this next week. But if you haven't figured it out by then feel free to bug me some more. :) |
Thanks for your answer. Just an update: everything seems to be fine in the |
I just ran into a strange issue, and I'm kind of surprised no one else seemed to do yet. I just wrote a request body description for a POST endpoint, requiring the request body to be of
application/json
and containing three fields, one of them an array of strings. When I try setting the array'sminItems
property to1
, I get an error sayingHowever, when I set it to
2
, parsing succeeds, and the endpoint returns validation errors when I pass an array with less than two items.The relevant part of the YAML reads like this:
Let me know if I can do anything to help debugging this.
Btw, this lib helps us tremendously developing our project in a future-proof way, thanks for that.
The text was updated successfully, but these errors were encountered: