summaryrefslogtreecommitdiffstats
path: root/media/mediaType.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-04-05 16:18:53 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-04-07 10:52:16 +0200
commit3c405f5172a6081483c9e5f4264a4d60e60bc8ac (patch)
treedbf2651314bfba7d6b8a8eaeb9f4acdd7814de5f /media/mediaType.go
parent95808724595ab97042c204f3d92ea5c2929a8241 (diff)
all: Document the Output Formats feature
This commit also adds a new command, docshelper, with some utility funcs that adds a JSON datafiles to /docs/data that would be a pain to create and maintain by hand. Fixes #3242
Diffstat (limited to 'media/mediaType.go')
-rw-r--r--media/mediaType.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/media/mediaType.go b/media/mediaType.go
index 942e9070e..6b6f90439 100644
--- a/media/mediaType.go
+++ b/media/mediaType.go
@@ -14,6 +14,7 @@
package media
import (
+ "encoding/json"
"fmt"
"sort"
"strings"
@@ -177,3 +178,16 @@ func DecodeTypes(maps ...map[string]interface{}) (Types, error) {
return m, nil
}
+
+func (t Type) MarshalJSON() ([]byte, error) {
+ type Alias Type
+ return json.Marshal(&struct {
+ Type string
+ String string
+ Alias
+ }{
+ Type: t.Type(),
+ String: t.String(),
+ Alias: (Alias)(t),
+ })
+}