Skip to content

Commit dcd5f44

Browse files
committed
remove unused majorVersions function
1 parent eae7776 commit dcd5f44

File tree

2 files changed

+0
-47
lines changed

2 files changed

+0
-47
lines changed

tools/openapi2crd/pkg/generator/generator.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,6 @@ func (g *Generator) Generate(ctx context.Context, crdConfig *v1alpha1.CRDConfig)
143143
return crd, nil
144144
}
145145

146-
func (g *Generator) majorVersions(config v1alpha1.CRDConfig) []string {
147-
result := make([]string, 0, len(config.Mappings))
148-
for _, m := range config.Mappings {
149-
result = append(result, "- "+m.MajorVersion)
150-
}
151-
152-
return result
153-
}
154-
155146
func clearPropertiesWithoutExtensions(schema *openapi3.Schema) bool {
156147
if schema == nil {
157148
return false

tools/openapi2crd/pkg/generator/generator_test.go

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -29,44 +29,6 @@ import (
2929
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3030
)
3131

32-
func TestGeneratorMajorVersions(t *testing.T) {
33-
tests := map[string]struct {
34-
config v1alpha1.CRDConfig
35-
expectedResult []string
36-
}{
37-
"mapping with single version": {
38-
config: v1alpha1.CRDConfig{
39-
Mappings: []v1alpha1.CRDMapping{
40-
{
41-
MajorVersion: "v1",
42-
},
43-
},
44-
},
45-
expectedResult: []string{"- v1"},
46-
},
47-
"mapping with multiple versions": {
48-
config: v1alpha1.CRDConfig{
49-
Mappings: []v1alpha1.CRDMapping{
50-
{
51-
MajorVersion: "v1",
52-
},
53-
{
54-
MajorVersion: "v2",
55-
},
56-
},
57-
},
58-
expectedResult: []string{"- v1", "- v2"},
59-
},
60-
}
61-
for name, tt := range tests {
62-
t.Run(name, func(t *testing.T) {
63-
g := &Generator{}
64-
result := g.majorVersions(tt.config)
65-
assert.Equal(t, tt.expectedResult, result)
66-
})
67-
}
68-
}
69-
7032
func TestClearPropertiesWithoutExtensions(t *testing.T) {
7133
tests := map[string]struct {
7234
schema *openapi3.Schema

0 commit comments

Comments
 (0)