dhall-kubernetes icon indicating copy to clipboard operation
dhall-kubernetes copied to clipboard

Support a toJSON for each type that converts Kubernetes objects into weakly typed JSON

Open s-zeng opened this issue 5 years ago • 2 comments

This was something that was brought up a while back: https://discourse.dhall-lang.org/t/expense-proposal-pure-dhall-function-to-render-yaml/92/10?u=s-zeng

But I did not find a matching ticket for it, so I'm creating one now with this ticket.

We should auto generate a toJSON function for each kubernetes type that transforms them into a weakly typed Prelude.JSON.object.

Use case: We can directly render yaml as text from dhall without needing dhall-to-yaml. In particular, I would find this very useful in making helm charts (our org requires making helm charts for making packages for external consumption) where it would become much more ergonomic to insert {{go template}} clauses for non-string purposes

s-zeng avatar Nov 11 '20 15:11 s-zeng

I think this is the ticket I'd suggest for this purpose:

https://github.com/dhall-lang/dhall-lang/issues/336

Gabriella439 avatar Nov 11 '20 16:11 Gabriella439

Isn’t JSON.object toMap … enough? If so, maybe extend the Readme examples for “list of kubernetes objects”. Because I don’t see how to put kubernetes objects and crds in the same list otherwise.

(But on the other hand, I only have multiple hours of dhall experience)

Edit: Ok, so JSON.object toMap kubernetesObject wont work as kubernetesObject very most likely is not an homogenous record. I see.

kosta avatar Jan 12 '23 21:01 kosta