|
4 | 4 | "bytes" |
5 | 5 | "context" |
6 | 6 | "encoding/json" |
7 | | - "errors" |
8 | 7 | "fmt" |
9 | 8 | "io" |
10 | 9 | "net/http" |
@@ -704,46 +703,7 @@ paths: |
704 | 703 | } |
705 | 704 |
|
706 | 705 | switch e := err.(type) { |
707 | | - case *openapi3filter.SecurityRequirementsError: |
708 | | - out := fmt.Sprintf("A SecurityRequirementsError was returned when attempting to authenticate the request to %s %s against %d Security Schemes: %s\n", opts.MatchedRoute.Route.Method, opts.MatchedRoute.Route.Path, len(e.SecurityRequirements), e.Error()) |
709 | | - for _, sr := range e.SecurityRequirements { |
710 | | - for k, v := range sr { |
711 | | - out += fmt.Sprintf("- %s: %v\n", k, v) |
712 | | - } |
713 | | - } |
714 | | - |
715 | | - fmt.Printf("ErrorHandlerWithOpts: %s\n", out) |
716 | | - |
717 | | - http.Error(w, "You're not allowed!", opts.StatusCode) |
718 | | - return |
719 | | - case *openapi3filter.RequestError: |
720 | | - out := fmt.Sprintf("A RequestError was returned when attempting to validate the request to %s %s: %s\n", opts.MatchedRoute.Route.Method, opts.MatchedRoute.Route.Path, e.Error()) |
721 | | - |
722 | | - if e.RequestBody != nil { |
723 | | - out += "This operation has a request body, which was " |
724 | | - if !e.RequestBody.Required { |
725 | | - out += "not " |
726 | | - } |
727 | | - out += "required\n" |
728 | | - } |
729 | | - |
730 | | - if childErr := e.Unwrap(); childErr != nil { |
731 | | - out += "There was a child error, which was " |
732 | | - switch e := childErr.(type) { |
733 | | - case openapi3.MultiError: |
734 | | - out += "a MultiError" + errors.Join(e).Error() |
735 | | - case *openapi3.SchemaError: |
736 | | - out += "a SchemaError, which failed to validate on the " + e.SchemaField + " field" |
737 | | - default: |
738 | | - out += "an unknown type (" + reflect.TypeOf(e).String() + ")" |
739 | | - } |
740 | | - } |
741 | | - |
742 | | - fmt.Printf("ErrorHandlerWithOpts: %s\n", out) |
743 | | - |
744 | | - http.Error(w, "A bad request was made - but I'm not going to tell you where or how", opts.StatusCode) |
745 | | - return |
746 | | - // NOTE that when it's a MultiError, there's more work needed here |
| 706 | + // NOTE that when it's a MultiError, there's more work needed here |
747 | 707 | case openapi3.MultiError: |
748 | 708 | for _, eee := range e { |
749 | 709 | fmt.Printf("eee: %v\n", eee) |
|
0 commit comments