pb33f/libopenapi-validator

OpenAPI 3.0.1 : path parameter validation does not comply the required schema

triptesh1212 opened this issue · 6 comments

Hi, I have the following schema defined.

paths:
  '/path123/{name}':
    get:
      description: Obtain information about a country from unique country name
      parameters:
        - name: name
          in: path
          required: true
          schema:
            type: string
            minLength: 3

(1) /path123/de path gives the following error which is expected.

"Path /path123/de is invalid or not supported"

(2) However if we pass empty path parameter /path123/ it passes and does not the return error

@daveshanley - can you please provide your comment on this ? My understanding is even if I dont specifiy a minLength property and keep required : true, I should not be allowed to make the call "/path123/ " . The validator should fail this.

Hi,

You have hit a block of code that has yet to be implemented.

https://github.com/pb33f/libopenapi-validator/blob/main/parameters/path_parameters.go#L88

You can see the TODO here. Essentially this block deals with a path param that has been defined, but no segment is provided in the URI request.

@daveshanley - thanks Dave . Any ETA for this ? Ideally, This is a very basic use case which should be handled by a validator.

It's not on my immediate radar, please feel welcome to submit a PR!

@daveshanley - raised a PR for this issue -#82

Added in v0.0.56