dadav/helm-schema

validation for optional blocks

Closed this issue ยท 1 comments

Hi there ๐Ÿ‘‹

Thanks for the awesome tool, it really saves us a lot of time!

I had a funny situation so thought of reaching out here to ask.

As a chart provider, we generate the schema from the default values.yaml file, there are some optional blocks we have that do not have default values, but actually just commented out. However, consumers of the chart can override these blocks in their own values.yaml. I would still like to generate a schema for that, so when it's specified it's valid, otherwise nothing happens.

So for example, in the default values.yaml we have:

# @schema
# additionalProperties: true
# properties:
#   httpGet:
#     type: object
#     properties:
#       path:
#         type: string
#       port:
#         type: [integer, string]
# @schema
# --- Startup probe that will be executed to check if the container has started and delay readiness and liveness probe. It helps to prevent that slow starting application get killed early.
#startupProbe:
#  httpGet:
#    path:
#    port:
#  failureThreshold:
#  periodSeconds:

the generated schema doesn't have the startupProbe in it, rightfully so because it's commented out.

however a chart consumer can optionally choose to use it but might enter faulty values.

How might we tackle this?

Many thanks

Hey, thanks for the positive feedback. Your usecase seems like good addition, I will work on this. I'm thinking about some kind of preprocessing would make this possible.