Open Silthus opened 7 months ago
Top comment is a bit of a problem because of helm-docs
. We would need to fight for the same space and eventually something won't work as expected. That's the reason why I decided for line comment which makes it impossible to be multi line. However, I'm open for ideas, suggestions or pull request.
Top comment is a bit of a problem because of
helm-docs
. We would need to fight for the same space and eventually something won't work as expected. That's the reason why I decided for line comment which makes it impossible to be multi line. However, I'm open for ideas, suggestions or pull request.
And what about being compatible with helm-docs
so that the same comments can be used for schema generation and helm-docs? This would even make a lot of sense, since as a Chart Maintainer I would want to generate a schema for validation and tooling support in IDEs and a Readme that contains the descriptions and types as well.
I was referring more to development of this plugin. When do you start reading comments and when do you stop? Is there something before or after in comments that should be ignored? Is it with annotation for schema, helm-docs or regular user comment? I avoided all of that by reading line comment. I understand that having all those things is very convenient for end users but moving to top comment will also introduce breaking change for existing users. For the record, I'm not against it but can't promise anything short term. Maybe for future major release like v2. Until then, I'll leave this issue open so that people can vote 👍 👎
My 2 cents:
helm schema blah blah --above-line-mode
(I hate it lol, there's definitely a better name for it out there somewhere). If the optional flag is enabled, the tool doesn't try to fight with helm-docs, it just assumes nothing else is there and it gets to do whatever it wants.Side node: I'm loving this tool, thanks a bunch @losisin for putting it out there, it's been perfect for my use case. If you turn on your sponsor button I want to buy you a beer or two
Different idea: if the # @schema
comment is on a different line, require a field that ties it back to the yaml key that you want it associated with. This would open things up to let you put it anywhere you want.
image:
repository: registry.example.com/foo
tag: 1.2.3
# @schema ref: image; description: Image settings
# @schema ref: image.repository; description: The repository to use; required: true; default: registry.example.com/foo
# @schema ref: image.tag; description: The tag to use
A side benefit would be I can do things this way and make the values.yaml file more readable for downstream users. It takes a lot of brain power to grok the yaml among all the line comments.
This example doesn't demonstrate the original ask of this issue though, as it still does just one line for each. Not sure how multiline might look, maybe something like
# @schema ref: image;
# description: Some long comment that spans
# multiple lines;
# @endschema
IDK, I'm sure there's probably a better way out there.
Regarding #51 it would also be very helpful to allow comments above a property to be parsed for the schema tags.
For example:
The above also defaults a non annotated comment above a property to use as the
description
. Maybe this could be turned on with a flag in the cli?