Skip to content

Commit

Permalink
fix recipe for validating http requests/responses (#474)
Browse files Browse the repository at this point in the history
  • Loading branch information
xorpaul authored Jan 13, 2022
1 parent c95dd68 commit e02b3c0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,16 @@ import (
"log"
"net/http"

"github.com/getkin/kin-openapi/openapi3"
"github.com/getkin/kin-openapi/openapi3filter"
legacyrouter "github.com/getkin/kin-openapi/routers/legacy"
)

func main() {
ctx := context.Background()
loader := &openapi3.Loader{Context: ctx}
loader := openapi3.Loader{Context: ctx}
doc, _ := loader.LoadFromFile("openapi3_spec.json")
_ := doc.Validate(ctx)
_ = doc.Validate(ctx)
router, _ := legacyrouter.NewRouter(doc)
httpReq, _ := http.NewRequest(http.MethodGet, "/items", nil)

Expand Down

0 comments on commit e02b3c0

Please sign in to comment.