thephpleague / openapi-psr7-validator

It validates PSR-7 messages (HTTP request/response) against OpenAPI specifications
MIT License
524 stars 94 forks source link

Path Validator Not Handling Missing Params #39

Open edmondscommerce opened 4 years ago

edmondscommerce commented 4 years ago

Firstly - thanks for this great library!

Found a fairly easy to fix issue though I think:

It's quite easy to get an undefined index error at

https://github.com/thephpleague/openapi-psr7-validator/blob/master/src/PSR7/Validators/PathValidator.php#L53

if you have not done written your spec properly, ie you have a path with a {param} but haven't actually added the param annotation to the request spec

This seems like an easy issue to catch and throw a useful exception as is being done elsewhere

I'd be happy to give it a go as a PR

scaytrase commented 4 years ago

Sounds valid. Could you please provide PR with failing test and a fix on top of it?

edmondscommerce commented 4 years ago

will do

edmondscommerce commented 4 years ago

PR is passing now, I think its functionally OK

sookoll commented 4 years ago

Any developments on this?

scaytrase commented 4 years ago

@sookoll You can take over an abandoned PR #41