/
schemainclreq.go
73 lines (57 loc) · 1.51 KB
/
schemainclreq.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
package jsonsch
import "sort"
type SchemaInclReq struct {
SchemaField string `json:"$schema,omitempty"`
Title string `json:"title"`
Type Type `json:"type"`
Description string `json:"description,omitempty"`
Properties map[string]interface{} `json:"properties"`
Required []string `json:"required"`
}
func NewInclReq() *SchemaInclReq {
return &SchemaInclReq{
Type: Object,
Properties: make(map[string]interface{}),
Required: make([]string, 0),
}
}
func (s *SchemaInclReq) SetRequired(r []string) {
s.Required = append(r)
sort.Strings(s.Required)
}
func (s *SchemaInclReq) GetRequired() []string {
return s.Required
}
func (s *SchemaInclReq) SetProperty(k string, v interface{}) {
s.Properties[k] = v
}
func (s *SchemaInclReq) SetProperties(ps map[string]interface{}) {
s.Properties = ps
}
func (s *SchemaInclReq) GetProperties() map[string]interface{} {
return s.Properties
}
func (s *SchemaInclReq) SetDescription(d string) {
s.Description = d
}
func (s *SchemaInclReq) GetDescription() string {
return s.Description
}
func (s *SchemaInclReq) SetType(t Type) {
s.Type = t
}
func (s *SchemaInclReq) GetType() Type {
return s.Type
}
func (s *SchemaInclReq) SetTitle(t string) {
s.Title = t
}
func (s *SchemaInclReq) GetTitle() string {
return s.Title
}
func (s *SchemaInclReq) SetSchemaField(sf string) {
s.SchemaField = sf
}
func (s *SchemaInclReq) GetSchemaField() string {
return s.SchemaField
}