dhall-kubernetes
dhall-kubernetes copied to clipboard
Support a toJSON for each type that converts Kubernetes objects into weakly typed JSON
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
I think this is the ticket I'd suggest for this purpose:
https://github.com/dhall-lang/dhall-lang/issues/336
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.