-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterfaces.go
More file actions
84 lines (67 loc) · 2.32 KB
/
interfaces.go
File metadata and controls
84 lines (67 loc) · 2.32 KB
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
package schema
// Common interfaces for schema setter methods
// These interfaces allow for type-safe casting and method calls without knowing the concrete type
// SetTitle interface for schemas that support setting a title
type SetTitle interface {
SetTitle(title string)
}
// SetDescription interface for schemas that support setting a description
type SetDescription interface {
SetDescription(description string)
}
// SetRequired interface for schemas that support setting required status
type SetRequired interface {
SetRequired()
}
// SetOptional interface for schemas that support setting optional status
type SetOptional interface {
SetOptional()
}
// SetMinimum interface for schemas that support setting minimum values (integers/numbers)
type SetMinimum interface {
SetMinimum(min int)
}
// SetMaximum interface for schemas that support setting maximum values (integers/numbers)
type SetMaximum interface {
SetMaximum(max int)
}
// SetMinimumFloat interface for schemas that support setting minimum float values (numbers)
type SetMinimumFloat interface {
SetMinimumFloat(min float64)
}
// SetMaximumFloat interface for schemas that support setting maximum float values (numbers)
type SetMaximumFloat interface {
SetMaximumFloat(max float64)
}
// SetMinLength interface for schemas that support setting minimum length (strings/arrays)
type SetMinLength interface {
SetMinLength(minLen int)
}
// SetMaxLength interface for schemas that support setting maximum length (strings/arrays)
type SetMaxLength interface {
SetMaxLength(maxLen int)
}
// SetPattern interface for schemas that support setting regex patterns (strings)
type SetPattern interface {
SetPattern(pattern string)
}
// SetMinItems interface for schemas that support setting minimum items (arrays)
type SetMinItems interface {
SetMinItems(min int)
}
// SetMaxItems interface for schemas that support setting maximum items (arrays)
type SetMaxItems interface {
SetMaxItems(max int)
}
// SetNullable interface for schemas that support setting nullable status
type SetNullable interface {
SetNullable()
}
// SetDefault interface for schemas that support setting default values
type SetDefault interface {
SetDefault(value interface{})
}
// SetExample interface for schemas that support setting example values
type SetExample interface {
SetExample(example interface{})
}