forked from goadesign/goa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
doc.go
33 lines (26 loc) · 1.17 KB
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
Package encoding provide goa adapters to many different encoders.
Use the Consumes and Produces DSL in your design to specify the encoding supported by the service.
var _ = API("MyAPI", func() {
// ...
Consumes("application/json", "application/gob")
Produces("application/json")
// ...
})
The built-in encoder and decoder media types are:
- application/json
- application/xml
- application/gob and application/x-gob
- application/msgpack and application/x-msgpack
- application/binc and application/x-binc
- application/cbor and application/x-cbor
External encoders and decoders can also be specified via the DSL:
Produces("application/json", func() { // Custom encoder
Package("github.com/goadesign/goa/encoding/json")
})
The DSL above causes the generated code to use the JSON encoder implemented in the package at
github.com/goadesign/goa/encoding/json rather than the stdlib JSON encoder. Third party encoders
can easily be used via adapter packages that expose the NewDecoder and NewEcoder methods expected
by the generated code, see the json package as an example.
*/
package encoding