losisin/helm-values-schema-json

pointers in values

curuvija opened this issue · 3 comments

Hi,

Can I set items in the array to a certain type, like string? I have a helm chart values where I need to set something like this (those should be the default values in the chart):

app: settings: writeNamespace: &writeNamespace app1 watchNamespaces: - *writeNamespace

And as a result of schema generation I get:

`
"writeNamespace": {
"type": [
"string"
]
}

"watchNamespaces": {
	"items": {
		"type": null
	},
	"type": "array"
},

`

It seems that the type is not detected. And this off course fails when I try to run helm template command. If I correct the type of the items manually, it works.

I went through the repo docs but I couldn't find the solution.

There is no support for yaml pointers or anchors because the yaml is not parsed before generating schema. The schema generation is based on go types and it's unclear what will the pointer resolve to. Although, to be fair, sounds like a bug because I would expect this to work:

 watchNamespaces:
    - *writeNamespace # @schema type:[string]

I can take a look after the holidays or you can jump on it with PR which is more than welcome

@curuvija turns out it was an easy fix. update to version v1.1.0

hi @losisin thanks a lot for the help. It works great, checked it a minute ago. Cheers :)