mirror of
https://github.com/kubevela/kubevela.git
synced 2026-08-19 04:26:39 +00:00
fix show annotations (#1711)
* fix show annotations * only fix map value
This commit is contained in:
@@ -140,6 +140,12 @@ var _ = Describe("Test Kubectl Plugin", func() {
|
||||
Expect(output).Should(ContainSubstring("targetPort"))
|
||||
Expect(output).Should(ContainSubstring("target port num for service provider."))
|
||||
})
|
||||
It("Test show traitDefinition def with cue single map parameter", func() {
|
||||
tdName := "annotations"
|
||||
output, err := e2e.Exec(fmt.Sprintf("kubectl-vela show %s", tdName))
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(output).Should(ContainSubstring("map[string]string"))
|
||||
})
|
||||
})
|
||||
|
||||
Context("Test kubectl vela comp discover", func() {
|
||||
|
||||
@@ -536,6 +536,17 @@ func (ref *ParseReference) parseParameters(paraValue cue.Value, paramKey string,
|
||||
if err != nil {
|
||||
return fmt.Errorf("arguments not defined as struct %w", err)
|
||||
}
|
||||
if arguments.Len() == 0 {
|
||||
var param ReferenceParameter
|
||||
param.Name = "undefined"
|
||||
param.Required = true
|
||||
tl := paraValue.Template()
|
||||
if tl != nil { // is map type
|
||||
param.PrintableType = fmt.Sprintf("map[string]%s", tl("").IncompleteKind().String())
|
||||
}
|
||||
params = append(params, param)
|
||||
}
|
||||
|
||||
for i := 0; i < arguments.Len(); i++ {
|
||||
var param ReferenceParameter
|
||||
fi := arguments.Field(i)
|
||||
|
||||
Reference in New Issue
Block a user