/
json.go
104 lines (86 loc) · 2.08 KB
/
json.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// The json package is used to serialize between rbxdump and Roblox JSON API
// dump format.
package json
import (
"strconv"
"github.com/robloxapi/rbxdump"
)
// VersionError is an error indicating that the version of the JSON format is
// unsupported.
type VersionError interface {
error
// VersionError returns the unsupported version.
VersionError() int
}
// errVersion implements the VersionError interface.
type errVersion int
func (err errVersion) Error() string {
return "version " + strconv.FormatInt(int64(err), 10) + " is unsupported"
}
type jRoot struct {
rbxdump.Root
}
type jClass struct {
Members []jMember
MemoryCategory string
Name string
Superclass string
Tags []string `json:",omitempty"`
index int
}
type jMember struct {
rbxdump.Member
yields int // Used to sort YieldFunctions after Functions.
}
type jProperty struct {
Category string
MemberType string
Name string
Security struct{ Read, Write string }
Serialization struct{ CanLoad, CanSave bool }
ThreadSafety string `json:",omitempty"`
Tags []string `json:",omitempty"`
ValueType rbxdump.Type
}
type jFunction struct {
MemberType string
Name string
Parameters []jParameter
ReturnType rbxdump.Type
Security string
ThreadSafety string `json:",omitempty"`
Tags []string `json:",omitempty"`
}
type jEvent struct {
MemberType string
Name string
Parameters []jBasicParameter
Security string
ThreadSafety string `json:",omitempty"`
Tags []string `json:",omitempty"`
}
type jCallback struct {
MemberType string
Name string
Parameters []jBasicParameter
ReturnType rbxdump.Type
Security string
ThreadSafety string `json:",omitempty"`
Tags []string `json:",omitempty"`
}
type jEnum struct {
Items []jEnumItem
Name string
Tags []string `json:",omitempty"`
}
type jEnumItem struct {
Name string
Tags []string `json:",omitempty"`
Value int
index int
}
type jParameter rbxdump.Parameter
type jBasicParameter struct {
Name string
Type rbxdump.Type
}