My question is really about the general use case of extending/overriding a schema in Dhall.
Here is an illustration with a small example.
Given this schema called ‘Secret.dhall’:
let k8s = https://raw.githubusercontent.com/dhall-lang/dhall-kubernetes/master/1.17/package.dhall
in { Type = k8s.Secret.Type
, default = k8s.Secret.default ⫽ { type = Some "Opaque" }
}
User can then use Secret.dhall
as such:
secrets = Some
[ Secret::{
, metadata = oc.core.ObjectMeta::{ name = Some "test.crt" }
, data = Some (toMap { test = "test"})
}
]
Let’s say I want the consummer of Secret.dhall
to go on using all the fields defined by the k8s.Secret.Type.
Let’s say I know user will only care about defining a name in the ObjectMeta field for Secret. What should I do if I wish to provide a more simple abstraction such as:
secrets = Some
[ Secret::{
, name = "test.crt"
, data = Some (toMap { test = "test"})
}
]
I can easily add a ‘name’ Type using Type = k8s.Secret.Type //\\ { name : Text}
. The challenge seems to change the metadata field in default
. Is this documentation relevant ?
I relate this question to a more general one. Do I need to use a recursive record machinery (as described in the doc) to emulate something like rec { version = "1.1", name = "foo-" + version }
from nix ?