1
0
mirror of https://github.com/rancher/steve.git synced 2025-09-16 07:18:28 +00:00

Fix missing fields in schema definition endpoint (#215)

This commit is contained in:
Tom Lebreux
2024-06-17 10:52:19 -04:00
committed by GitHub
parent d0f58fc918
commit 9ac9be9c0e
10 changed files with 1761 additions and 205 deletions

View File

@@ -1,7 +1,6 @@
package definitions
import (
"fmt"
"testing"
"github.com/stretchr/testify/require"
@@ -55,13 +54,13 @@ var (
"missing",
},
}
protoRefNoSubSchema = testRef{
protoRefNoSubSchema = openAPIV2Reference{
BaseSchema: proto.BaseSchema{
Description: "testRef - no subSchema",
},
reference: "some-other-type",
}
protoRef = testRef{
protoRef = openAPIV2Reference{
BaseSchema: proto.BaseSchema{
Description: "testRef",
},
@@ -75,29 +74,6 @@ var (
}
)
// testRef implements proto.Reference to test VisitReference
type testRef struct {
proto.BaseSchema
reference string
subSchema proto.Schema
}
func (t *testRef) Reference() string {
return t.reference
}
func (t *testRef) SubSchema() proto.Schema {
return t.subSchema
}
func (t *testRef) Accept(v proto.SchemaVisitor) {
v.VisitReference(t)
}
func (t *testRef) GetName() string {
return fmt.Sprintf("Reference to %q", t.reference)
}
func TestSchemaFieldVisitor(t *testing.T) {
protoKind.Fields["protoRef"] = &protoRef
tests := []struct {