- [x] Builtin directive `form` to decode a field from HTTP query, i.e. `http.Request.Form`
- [x] Builtin directive `header` to decode a field from HTTP headers, e.g. `http.Request.Header`
- [x] Builtin decoders used by `form` and `header` directives for basic types, e.g. `bool`, `int`, `int64`, `float32`, `time.Time`, ... [full list](./decoders.go)
- [x] Decode a field by inspecting a set of keys from the same source
- [x] Decode a field from multiple sources, e.g. both query and headers
- [ ] Register or replace decoders for both builtin basic types and custom types
- [ ] Register or replace encoders for both builtin basic types and custom types
- [x] Register custom directive executors to extend the field resolving abilities, see directive [required](./required.go) as an example and think about implementing your own directives like `trim`, `to_lowercase`, `base58_to_int`, etc.
A directive consists of two parts separated by an equal sign (`=`). The left part is the name of an executor who was designed to run this directive. The right part is a list of arguments separated by commas (`,`) which will be passed to the corresponding executor as its arguments.
For instance, `form=access_token,token`, here `form` is the name of the executor, and `access_token,token` is the argument list will be parsed as `[]string{"access_token", "token"}`.
There are several builtin directive executors, e.g. `form`, `header`, `required`, etc. See the [full list](./directives.go). And you can define your own by:
First, create a "directive executor" by implementing the `httpin.DirectiveExecutor` interface: