Skip to content
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

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

Closed
triptesh1212 opened this issue May 2, 2024 · 6 comments
Labels
enhancement New feature or request

Comments

@triptesh1212
Copy link

triptesh1212 commented May 2, 2024

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

@budanm
Copy link

budanm commented May 3, 2024

@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.

@daveshanley
Copy link
Member

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.

@budanm
Copy link

budanm commented May 3, 2024

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

@daveshanley
Copy link
Member

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

@daveshanley daveshanley added the enhancement New feature or request label May 4, 2024
budanm pushed a commit to budanm/pathparameterissue that referenced this issue May 7, 2024
For a path parameter which is marked as required , empty value should not be allowed. Ideally , in this case , we do not need to proceed towards enum check as the absence of a value should violate the mandatory path parameter requirement criteria irrespective of the schema of path parameter
@budanm
Copy link

budanm commented May 7, 2024

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

budanm pushed a commit to budanm/pathparameterissue that referenced this issue May 8, 2024
daveshanley pushed a commit that referenced this issue May 8, 2024
For a path parameter which is marked as required , empty value should not be allowed. Ideally , in this case , we do not need to proceed towards enum check as the absence of a value should violate the mandatory path parameter requirement criteria irrespective of the schema of path parameter
daveshanley pushed a commit that referenced this issue May 8, 2024
@daveshanley
Copy link
Member

Added in v0.0.56

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants