pb33f/libopenapi-validator

Validation of simple parameters

ndreno opened this issue · 6 comments

ndreno commented

Hi there, I think I'm facing an issue with validation.

Example like the following:

- in: query
  name: count
  description: number of facts to return
  required: false
  schema:
    type: integer
    format: int32
    minimum: 1

There is no check on the minimum value in that case with simple schema having a primitive type like integer.

When it is working with:

ListSpacesPage:
  name: "page"
  in: "query"
  style: "deepObject"
  description: "list spaces paginated request"
  required: false
  schema:
    type: object
    properties:
      size:
        type: integer
        description: The maximum number of items to return. The service may return fewer than this value.
        minimum: 1
        maximum: 50
        default: 30
        format: int32
        require: false

Is this by design, a bug, or I'm missing something?

Cheers and thank you for this amazing lib and the work you're putting in.

Before I can be helpful, I need to know how you're calling this, what are you validating? a Parameter? a schema? a header? a request? Can you share a code snippet?

ndreno commented

hey there, thanks for your quick reply.

We've been trying to validate a query param. I've shared the OAS chunk above where you can see "in: query".
We are simply using the highLevelValidator.ValidateHttpRequest(req)

thanks for your help

I am not sure, I will have to investigate, it's been a hot minute since I looked at that code.

ndreno commented

sure no problem, I'm pretty sure the validation method exists, but it is just not called for this specific use case from what I've seen

i made #55 for this issue

Fixed by @emilien-puget in v0.0.43