I'm playing around with dhall, trying to represent an existing large yaml file I have instead in dhall.
Specifically, I'm trying to build dhall types and helpers for a concourse pipeline definition. Part of the yaml that defines a concourse pipeline looks like the yaml I've written here. Each resource in my list contains a name, a type and then a source whose structure depends entirely on the type of the resource.
There is no exhaustive list of resources for me to define since someone could create a new one tomorrow and I wouldn't want to update my types each time some third party creates a new source type.
The dhall I have for this is witten here too, but I'm unsure how I could represent source
. I had considered omitting this field from my type and instructing consumers to use dhall's //
operator to add a source, but then it becomes difficult to embed resource
s in a [resource]
and still have type checking.
How can I define a dhall type for resource that contains within it a field whose value is unstructured.
resources:
- name: my-repo
type: git
source:
$some_unstructured_yaml
{ name : Text
, type : Text
, source : Optional ???
}