You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .claude/CLAUDE.md
+15-5Lines changed: 15 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,22 +12,23 @@ See [docs/MAINTAINERS.md](../docs/MAINTAINERS.md) for CI/CD, release process, an
12
12
13
13
### Modules and Package layout
14
14
15
-
This is a mono-repo with a `go.work` workspace containing two modules:
15
+
This is a mono-repo with a `go.work` workspace containing three modules:
16
16
17
17
| Module | Purpose |
18
18
|--------|---------|
19
19
|`.` (root) | Core runtime library |
20
-
|`client-middleware/opentracing`| Optional OpenTracing middleware for client transport |
20
+
|`server-middleware`| Standalone, dependency-free server middleware: `mediatype`, `negotiate`, `negotiate/header`, `docui`. No transitive dependency on `go-openapi/spec`, `loads`, or `validate`. |
21
+
|`client-middleware/opentracing`| Optional OpenTracing middleware for client transport (compatibility module; new code should use the OpenTelemetry support built into `client.Runtime`). |
|`middleware`| Server-side request lifecycle: routing, parameter binding, validation, security, operation execution. Doc-UI and negotiation primitives have moved to `server-middleware/*`; the legacy entry points (`Spec`, `SwaggerUI`, `RapiDoc`, `Redoc`, `NegotiateContentType`, …) remain as deprecated shims in `seam.go`.|
Copy file name to clipboardExpand all lines: .github/copilot-instructions.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,17 +13,18 @@ This is a mono-repo with a `go.work` workspace:
13
13
| Module | Purpose |
14
14
|--------|---------|
15
15
|`.` (root) | Core runtime library |
16
-
|`client-middleware/opentracing`| Optional OpenTracing middleware for client transport |
16
+
|`server-middleware`| Standalone, dependency-free server middleware (`mediatype`, `negotiate`, `negotiate/header`, `docui`) |
17
+
|`client-middleware/opentracing`| OpenTracing middleware for client transport (compatibility module; prefer the OpenTelemetry support built into `client.Runtime`) |
|`middleware`| Server request lifecycle: routing, parameter binding, validation, security, operation execution. Doc-UI and negotiation primitives moved to `server-middleware/*`; legacy entry points remain as deprecated shims in `seam.go`.|
- OpenTracing lives in a separate module to avoid pulling its dependency into the core.
51
+
-`server-middleware` is a separate module so any `net/http` app can use negotiation, media-type, and doc-UI primitives without inheriting the OpenAPI spec/loads/validate tree.
Standalone, dependency-free server-side middleware utilities for OpenAPI applications.
6
+
7
+
This module is part of the [`go-openapi/runtime`][runtime-url] toolkit, but is
8
+
maintained as a **separate Go module** so it can be used by any `net/http`
9
+
application — including ones that have no OpenAPI spec at all. It carries no
10
+
transitive dependency on `go-openapi/spec`, `go-openapi/loads`, or
11
+
`go-openapi/validate`; only the standard library and (for tests)
12
+
`go-openapi/testify/v2`.
13
+
14
+
## Packages
15
+
16
+
| Package | Purpose |
17
+
|---------|---------|
18
+
|[`mediatype`](./mediatype)| Typed RFC 7231 / RFC 2045 media-type values (`MediaType`, `Set`) and asymmetric matching used by both server-side validation and `Accept`-header negotiation. |
19
+
|[`negotiate`](./negotiate)| Server-side HTTP content negotiation: select the response `Content-Type` from `Accept`, and the response `Content-Encoding` from `Accept-Encoding`. Honours MIME parameters by default; opt out with `WithIgnoreParameters`. |
20
+
|[`negotiate/header`](./negotiate/header)| Low-level RFC-7231 header parsing primitives reused by `negotiate`. Exported for callers that need raw `Accept`/`Accept-Encoding` parsing without the typed media-type layer. |
21
+
|[`docui`](./docui)| Stdlib-only HTTP middlewares that serve OpenAPI documentation UIs (Swagger UI, ReDoc, RapiDoc) and the spec document itself. Mountable on any `net/http` mux. |
22
+
23
+
## Install
24
+
25
+
```sh
26
+
go get github.com/go-openapi/runtime/server-middleware
0 commit comments