kcd
CtrlK
  • KCD ? What is that
  • Getting started
  • Handler
    • The magic behind kcd.Handler
    • How to use kcd.Handler
  • concepts
    • Handler
    • Input
    • Output
    • Hooks
    • Extractors
  • Input
    • Supported field types
    • Bind from body json
    • Bind path parameter
    • Bind query parameter
    • Bind context values
    • Bind header values
    • Default value
    • Validation
    • Exploder for slices
    • Nested fields and path system
    • Custom unmarshal (json, binary, text)
  • output
    • Returning JSON response
    • Errors
      • Throw special http status code
  • hooks & extractors
    • Override a default hook
    • Error hook
    • Render hook
    • Bind hook
    • Validate hook
    • Log hook
    • String extractor
    • Value extractor
  • Real world use case
    • Pagination
    • Conditionally render your outputs
  • Compatible with
    • Compatible with ?
    • Compatible with chi
    • Compatible with gin
    • Compatible with gorilla/mux
    • Compatible with echo
    • Compatible with the standard library
Powered by GitBook
On this page

Was this helpful?

  1. hooks & extractors

Validate hook

The validate hook is the hook called to validate your input after it has been parsed. The default expected error for a validation error by the error hook is a map[string]error . By default the hook use ozzo-validation.

A validate hook must have this signature:

type ValidateHook func(ctx context.Context, input interface{}) error

Check out the default validate hook implementation here.

Check out the signature of the validate hook.

PreviousBind hookNextLog hook

Last updated 4 years ago

Was this helpful?