pb33f/libopenapi-validator

checkPathAgainstBase with basePath '/'

tsu1980 opened this issue · 2 comments

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]
		}

Would you be able to contribute this code yourself? This is a fully open source project and only thrives when the community feeds back into it. I can make the change, but it's your discovery and you should get the recognition for it.

can you check with the latest version v0.0.47 ?