Skip to content

Commit eb3bd3b

Browse files
author
Jamie Tanna
committed
rew
1 parent 5324ea6 commit eb3bd3b

File tree

1 file changed

+34
-4
lines changed

1 file changed

+34
-4
lines changed

README.md

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,43 @@
1-
# `net/http` Middleware
1+
# OpenAPI Validation Middleware for `net/http`-compatible servers
2+
3+
An HTTP middleware to perform validation of incoming requests via an OpenAPI specification.
4+
5+
This project is a lightweight wrapper over the excellent [kin-openapi](https://github.com/getkin/kin-openapi) library's [`openapi3filter` package](https://pkg.go.dev/github.com/getkin/kin-openapi/openapi3filter).
6+
7+
This is _intended_ to be used with code that's generated through [`oapi-codegen`](https://github.com/oapi-codegen/oapi-codegen), but should work otherwise.
28

39
⚠️ This README may be for the latest development version, which may contain unreleased changes. Please ensure you're looking at the README for the latest release version.
410

5-
Middleware for servers that implement `net/http` handlers, for use with [deepmap/oapi-codegen](https://github.com/deepmap/oapi-codegen), which has been tested to work with:
11+
## Usage
12+
13+
```go
14+
# TODO
15+
```
16+
17+
## FAQs
18+
19+
### Which HTTP servers should this work with?
20+
21+
If you're using something that's compliant with `net/http` (which should be all Go web frameworks / routers / HTTP servers) it should work as-is.
22+
23+
We explicitly test with the following servers, as they correspond with versions used by users of [oapi-codegen/oapi-codegen](https://github.com/oapi-codegen/oapi-codegen):
624

725
- [Chi](https://github.com/go-chi/chi)
826
- [gorilla/mux](https://github.com/gorilla/mux)
927
- [net/http](https://pkg.go.dev/net/http)
1028

11-
But if you're using something that's compliant with `net/http` it should work as-is.
29+
### "This doesn't support ..." / "I think it's a bug that ..."
30+
31+
As this project is a lightweight wrapper over [kin-openapi](https://github.com/getkin/kin-openapi)'s [`openapi3filter` package](https://pkg.go.dev/github.com/getkin/kin-openapi/openapi3filter), it's _likely_ that any bugs/features are better sent upstream.
32+
33+
However, it's worth raising an issue here instead, as it'll allow us to triage it before it goes to the kin-openapi maintainers.
34+
35+
Additionally, as `oapi-codegen` contains [a number of middleware modules](https://github.com/search?q=org%3Aoapi-codegen+middleware&type=repositories), we'll very likely want to implement the same functionality across all the middlewares, so it may take a bit more coordination to get the changes in across our middlewares.
36+
37+
### I've just updated my version of `kin-openapi`, and now I can't build my code 😠
38+
39+
The [kin-openapi](https://github.com/getkin/kin-openapi) project - which we 💜 for providing a great library and set of tooling for interacting with OpenAPI - is a pre-v1 release, which means that they're within their rights to push breaking changes.
40+
41+
This may lead to breakage in your consuming code, and if so, sorry that's happened!
1242

13-
Licensed under the Apache-2.0.
43+
We'll be aware of the issue, and will work to update both the core `oapi-codegen` and the middlewares accordingly.

0 commit comments

Comments
 (0)