Skip to content

Commit e02b3c0

Browse files
authored
fix recipe for validating http requests/responses (#474)
1 parent c95dd68 commit e02b3c0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,16 @@ import (
7070
"log"
7171
"net/http"
7272

73+
"github.com/getkin/kin-openapi/openapi3"
7374
"github.com/getkin/kin-openapi/openapi3filter"
7475
legacyrouter "github.com/getkin/kin-openapi/routers/legacy"
7576
)
7677

7778
func main() {
7879
ctx := context.Background()
79-
loader := &openapi3.Loader{Context: ctx}
80+
loader := openapi3.Loader{Context: ctx}
8081
doc, _ := loader.LoadFromFile("openapi3_spec.json")
81-
_ := doc.Validate(ctx)
82+
_ = doc.Validate(ctx)
8283
router, _ := legacyrouter.NewRouter(doc)
8384
httpReq, _ := http.NewRequest(http.MethodGet, "/items", nil)
8485

0 commit comments

Comments
 (0)