stefanprodan / timoni

Timoni is a package manager for Kubernetes, powered by CUE and inspired by Helm.
https://timoni.sh
Apache License 2.0
1.53k stars 68 forks source link

Module Markdown Optional Fields #334

Open Nalum opened 8 months ago

Nalum commented 8 months ago

Based on feedback in https://github.com/cue-lang/cue/discussions/2783 this PR updates the Markdown document generation to pull the optional fields into the table data. This is done via the cue.Value.Fields() iterator.

Nalum commented 6 months ago

@stefanprodan with some feedback from the cue team I've gotten this so it now will print the definition of the field, see the README for the blueprints starter module. I want to refine the module so that name and namespace are not output, but wanted to bring it to your attention.

Nalum commented 6 months ago

I'm still not getting what I want from the labels and annotations though :/

Nalum commented 2 days ago

I have pulled and rebased the latest main, this behaves in the same way. I think the changes here are worth merging, I'll spend some time digging into cue releases since the initial work on this and see if I can get the result I initially wanted for annotations and labels.

stefanprodan commented 2 days ago

Hey @Nalum with this we remove the default column from the readme, would be possible to preserve it or we need to merge type with defaults? If so, I think we need to rename the type column to something else.

Nalum commented 2 days ago

I removed it because the type information have use the type and the default in one result, ~I had not found a way to get both separately at the time, maybe there is a way now, I'll dig into that too.~ scratch that, it was doing this, I can't recall the reason for making that change now.

Do you want to hold off on merging this for now so?

Nalum commented 2 days ago

Ah I think the goal was to show the cue type information as is. For example if we just had the type and default this would not show you the possible values:

| `test: startupAPICheck: service: type:` | `*"ClusterIP" \| "NodePort" \| "LoadBalancer" \| "ExternalName"` |

You would have this instead:

| `test: startupAPICheck: service: type:` | `string` | `ClusterIP` |
Nalum commented 2 days ago

I guess this adds a requirement to understand cue syntax :thinking: