Skip to content
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

fix compile errors in README example code #842

Merged
merged 1 commit into from
Sep 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ doc, err := loader.LoadFromFile("swagger.json")
```go
loader := openapi3.NewLoader()
doc, _ := loader.LoadFromData([]byte(`...`))
_ := doc.Validate(loader.Context)
_ = doc.Validate(loader.Context)
router, _ := gorillamux.NewRouter(doc)
route, pathParams, _ := router.FindRoute(httpRequest)
// Do something with route.Operation
Expand All @@ -103,7 +103,7 @@ func main() {
loader := &openapi3.Loader{Context: ctx, IsExternalRefsAllowed: true}
doc, _ := loader.LoadFromFile(".../My-OpenAPIv3-API.yml")
// Validate document
_ := doc.Validate(ctx)
_ = doc.Validate(ctx)
router, _ := gorillamux.NewRouter(doc)
httpReq, _ := http.NewRequest(http.MethodGet, "/items", nil)

Expand All @@ -116,7 +116,7 @@ func main() {
PathParams: pathParams,
Route: route,
}
_ := openapi3filter.ValidateRequest(ctx, requestValidationInput)
_ = openapi3filter.ValidateRequest(ctx, requestValidationInput)

// Handle that request
// --> YOUR CODE GOES HERE <--
Expand All @@ -131,7 +131,7 @@ func main() {
Header: responseHeaders,
}
responseValidationInput.SetBodyBytes(responseBody)
_ := openapi3filter.ValidateResponse(ctx, responseValidationInput)
_ = openapi3filter.ValidateResponse(ctx, responseValidationInput)
}
```

Expand Down