libopenapi-validator
libopenapi-validator copied to clipboard
checkPathAgainstBase with basePath '/'
Thanks your great job.
I found problem when Server path is no base path like this.
servers:
- url: 'http://127.0.0.1/'
This will call checkPathAgainstBase with basePath '/'. And the checkPathAgainstBase trim basePath last slash here, but if basePath is '/', basePaths is to be empty string. It's unexpected behavior, right?
so I think the code should be fixed like this.
if len(basePaths[i]) > 1 && basePaths[i][len(basePaths[i])-1] == '/' {
basePaths[i] = basePaths[i][:len(basePaths[i])-1]
}