-
-
Notifications
You must be signed in to change notification settings - Fork 443
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
no matching operation was found when servers are defined #356
Comments
Interestingly when I duplicate that router and remove the offending code; func (router *Router) FindRoute(req *http.Request) (*routers.Route, map[string]string, error) {
method, url := req.Method, req.URL
doc := router.doc
// Get server
// servers := doc.Servers
// var server *openapi3.Server
var remainingPath string
var pathParams map[string]string
// if len(servers) == 0 {
remainingPath = url.Path
/*} else {
var paramValues []string
server, paramValues, remainingPath = servers.MatchURL(url)
if server == nil {
return nil, nil, &routers.RouteError{
Reason: routers.ErrPathNotFound.Error(),
}
}
pathParams = make(map[string]string, 8)
paramNames, _ := server.ParameterNames()
for i, value := range paramValues {
name := paramNames[i]
pathParams[name] = value
}
}*/
// Get PathItem
root := router.node()
var route *routers.Route The validation works, no idea how or why |
Could you tell us more? e.g. what's the value of Ideally you'd formulate your issue as a test and open a PR with it to prove something isn't right. |
Thanks for the bug PR! Ah it seems you're hitting #118 |
I'm not sure it is the same as being unable to process localhost. I first came across the problem connecting to a development server that was defined as
As I said on my second comment, I can work around it - but I'm not sure I should be submitting that as a PR as it's probably used for another scenario I'm unfamiliar with |
oh, or I can just remove the servers from the spec altogether and it works fine without changing code :) |
Isn't the whole of 192.168 submask LAN? In any case these hosts are probably handled similarly to localhost by Golang.
is discussed there as well :) |
using gin gonic is a framework, I can't seem to match a route to the the api spec
my code is pretty much as per example;
I traced the problem to this part of the code
servers =
url =
/plans
and that definitely exists in my openapi.yml fileThe text was updated successfully, but these errors were encountered: