1
0
mirror of https://github.com/rancher/steve.git synced 2025-09-20 11:00:25 +00:00

Add test for empty schema

This commit is contained in:
Chad Roberts
2025-01-28 10:54:50 -05:00
parent 879a6d30f3
commit b7afe7bdb3

View File

@@ -78,6 +78,12 @@ var (
}, },
SubType: &protoKind, SubType: &protoKind,
} }
protoEmpty = proto.Kind{
BaseSchema: proto.BaseSchema{
Description: "emptySchema",
Path: proto.NewPath("io.cattle.empty"),
},
}
) )
func TestSchemaFieldVisitor(t *testing.T) { func TestSchemaFieldVisitor(t *testing.T) {
@@ -277,6 +283,21 @@ func TestSchemaFieldVisitor(t *testing.T) {
Description: "multi-level nested structure", Description: "multi-level nested structure",
}, },
}, },
{
name: "empty schema",
inputSchema: &protoEmpty,
wantDefinitions: map[string]definition{
"io.cattle.empty": {
ResourceFields: map[string]definitionField{},
Type: "io.cattle.empty",
Description: protoEmpty.Description,
},
},
wantField: definitionField{
Type: "io.cattle.empty",
Description: protoEmpty.Description,
},
},
} }
for _, test := range tests { for _, test := range tests {