krakenjs / hapi-openapi

Build design-driven apis with OpenAPI (formerly swagger) 2.0 and hapi.
Other
211 stars 75 forks source link

Multi-segment paths break with "Invalid request params input" #151

Closed jdarling closed 5 years ago

jdarling commented 5 years ago

If you have a multi-segment path defined (/api/v1/proxy/{path}) it breaks when it creates the validator due to it creating the param name as "path" instead of "path". As multi-segment parameters can also have a repeat variable (path*2 as example) replacing the path variable name needs to take this into account.

Fix is pretty straight forward, in validators.js line 166 change to:

validate.params[validator.parameter.name.replace(/\*[0-9]*$/, '')] = validator.schema;

Will submit a PR for this.