-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlockfile.go
61 lines (53 loc) · 2.7 KB
/
lockfile.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
package config
import (
"github.com/google/uuid"
orderedmap "github.com/wk8/go-ordered-map/v2"
"gopkg.in/yaml.v3"
)
type LockFile struct {
LockVersion string `yaml:"lockVersion"`
ID string `yaml:"id"`
Management Management `yaml:"management"`
Features map[string]map[string]string `yaml:"features,omitempty"`
GeneratedFiles []string `yaml:"generatedFiles,omitempty"`
Examples Examples `yaml:"examples,omitempty"`
GeneratedTests GeneratedTests `yaml:"generatedTests,omitempty"`
AdditionalProperties map[string]any `yaml:",inline"` // Captures any additional properties that are not explicitly defined for backwards/forwards compatibility
}
type Management struct {
DocChecksum string `yaml:"docChecksum,omitempty"`
DocVersion string `yaml:"docVersion,omitempty"`
SpeakeasyVersion string `yaml:"speakeasyVersion,omitempty"`
GenerationVersion string `yaml:"generationVersion,omitempty"`
ReleaseVersion string `yaml:"releaseVersion,omitempty"`
ConfigChecksum string `yaml:"configChecksum,omitempty"`
RepoURL string `yaml:"repoURL,omitempty"`
RepoSubDirectory string `yaml:"repoSubDirectory,omitempty"`
InstallationURL string `yaml:"installationURL,omitempty"`
Published bool `yaml:"published,omitempty"`
AdditionalProperties map[string]any `yaml:",inline"` // Captures any additional properties that are not explicitly defined for backwards/forwards compatibility
}
type (
Examples = *orderedmap.OrderedMap[string, *orderedmap.OrderedMap[string, OperationExamples]]
GeneratedTests = *orderedmap.OrderedMap[string, string]
)
type OperationExamples struct {
Parameters *ParameterExamples `yaml:"parameters,omitempty"`
RequestBody *orderedmap.OrderedMap[string, yaml.Node] `yaml:"requestBody,omitempty"`
Responses *orderedmap.OrderedMap[string, *orderedmap.OrderedMap[string, yaml.Node]] `yaml:"responses,omitempty"`
}
type ParameterExamples struct {
Path *orderedmap.OrderedMap[string, yaml.Node] `yaml:"path,omitempty"`
Query *orderedmap.OrderedMap[string, yaml.Node] `yaml:"query,omitempty"`
Header *orderedmap.OrderedMap[string, yaml.Node] `yaml:"header,omitempty"`
}
var getUUID = func() string {
return uuid.NewString()
}
func NewLockFile() *LockFile {
return &LockFile{
LockVersion: v2,
ID: getUUID(),
Features: map[string]map[string]string{},
}
}