forked from aep-dev/aepcli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.go
More file actions
47 lines (41 loc) · 938 Bytes
/
debug.go
File metadata and controls
47 lines (41 loc) · 938 Bytes
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
package main
import (
"fmt"
"github.com/aep-dev/aep-lib-go/pkg/api"
"github.com/aep-dev/aep-lib-go/pkg/openapi"
)
func main() {
a := &api.API{
Name: "test",
ServerURL: "https://api.example.com",
Resources: map[string]*api.Resource{
"project": {
Singular: "project",
Plural: "projects",
Parents: []string{},
Schema: &openapi.Schema{},
},
"dataset": {
Singular: "dataset",
Plural: "datasets",
Parents: []string{"project"},
Schema: &openapi.Schema{},
},
},
}
err := api.AddImplicitFieldsAndValidate(a)
if err != nil {
panic(err)
}
dataset := a.Resources["dataset"]
patternElems := dataset.PatternElems()
fmt.Printf("Dataset PatternElems: %+v\n", patternElems)
// Simulate the flag creation logic
i := 1
for i < len(patternElems)-1 {
p := patternElems[i]
flagName := p[1 : len(p)-1]
fmt.Printf("Would create flag: --%s\n", flagName)
i += 2
}
}