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
* problem out: `ProblemResponse(...)`, `NewBadRequestProblem(...)`, `Problem(...).Build()`
206
+
* validation: configure once with `SetValidator(...)`, override locally with `ParseOptions.Validator`
44
207
45
208
For simple handlers, prefer direct helpers.
46
209
47
-
When a handler needs custom headers, meta, or problem composition, use the optional builders.
210
+
When a handler needs custom headers, metadata, or problem composition, use the optional builders.
48
211
49
212
`ParseRequest` never panics on invalid inputs such as a nil request, nil body, or nil path extractor. These cases return regular Go errors so callers can fail safely.
* validation is opt-in at bootstrap, automatic at parse time when configured
333
+
* response metadata is generic and can use `PageMeta` or `CursorMeta`
195
334
196
335
## Migration from v2 to v3
197
336
198
-
- update imports from `github.com/rluders/httpsuite/v2` to `github.com/rluders/httpsuite/v3`
199
-
- update `ParseRequest` calls to pass `opts` before `pathParams`
200
-
- configure validation globally with `httpsuite.SetValidator(...)` or `playground.RegisterDefault()`
201
-
-`ParseRequest` now validates automatically when a validator is configured
202
-
- validator-provided `ProblemDetails.Status` is respected when valid
203
-
- use `ParseOptions.SkipValidation` to opt out per call
204
-
- use `ParseOptions.Validator` to override the global validator per call
205
-
- use `ProblemConfig`when you want custom problem type URLs
337
+
* update imports from `v2` to `v3`
338
+
* update `ParseRequest` calls to pass `opts` before `pathParams`
339
+
* configure validation globally with `httpsuite.SetValidator(...)`
340
+
*`ParseRequest` now validates automatically when a validator is configured
341
+
* validator-provided status is respected
342
+
* use `ParseOptions.SkipValidation` to opt out per call
343
+
* use `ParseOptions.Validator` to override per call
344
+
* use `ProblemConfig`for custom problem type URLs
206
345
207
346
## Examples
208
347
209
-
Examples live in [`examples/`](examples/).
348
+
Examples live in `examples/`.
210
349
211
-
-[`examples/stdmux`](examples/stdmux/main.go): core-only with `http.ServeMux`
212
-
-[`examples/gorillamux`](examples/gorillamux/main.go): path params with Gorilla Mux
213
-
-[`examples/chi`](examples/chi/main.go): global validation with Chi
214
-
-[`examples/restapi`](examples/restapi/main.go): fuller REST API example with pagination-style metadata and custom problems
215
-
216
-
`examples/restapi` shows:
217
-
218
-
- global validator setup with `playground`
219
-
-`ProblemConfig` with custom type URLs
220
-
- create, get, and list endpoints
221
-
-`PageMeta` and `CursorMeta`
222
-
- direct helpers and fluent helpers together
223
-
- custom `ProblemDetails` for domain-level `404`s
350
+
*`examples/stdmux`: core-only with `http.ServeMux`
351
+
*`examples/gorillamux`: path params with Gorilla Mux
352
+
*`examples/chi`: global validation with Chi
353
+
*`examples/restapi`: full REST example with pagination and custom problems
224
354
225
355
## Notes for contributors
226
356
227
-
- request facade and helpers live in`request*.go`
228
-
- response facade, helpers, builders, and write internals live in`response*.go`
229
-
- problem details, config, builders, and helpers live in`problem*.go`
357
+
* request helpers:`request*.go`
358
+
* response helpers/builders:`response*.go`
359
+
* problem handling:`problem*.go`
230
360
231
361
## Release workflow
232
362
233
-
The release workflow supports two paths:
234
-
235
-
- push an existing `v*` tag to verify and publish that release
236
-
- run `Release` with `workflow_dispatch` and choose `major`, `minor`, or `patch`
363
+
Supports:
237
364
238
-
On manual dispatch, the workflow finds the latest `v*` tag, bumps it according to the selected semantic version part, pushes the new tag, and publishes the GitHub release for that tag.
365
+
* pushing an existing `v*` tag
366
+
* manual release with semantic version bump
239
367
240
368
## Tutorial
241
369
242
-
-[Improving Request Validation and Response Handling in Go Microservices](https://medium.com/@rluders/improving-request-validation-and-response-handling-in-go-microservices-cc54208123f2)
243
-
244
-
> Do you have a project example or a tutorial? Add it here.
370
+
*[Improving Request Validation and Response Handling in Go Microservices](https://medium.com/@rluders/improving-request-validation-and-response-handling-in-go-microservices-cc54208123f2), about the first released version.
0 commit comments