dhall-haskell
dhall-haskell copied to clipboard
dhall-openapi: configuration file rfc
It seems like the openapi-to-dhall command could use some custom configuration:
- A list of model name prefix to keep (or filter) (use-case: https://github.com/TristanCacqueray/dhall-openshift/issues/6)
- A list of model name prefix to use for conflict resolution (use-case: https://github.com/dhall-lang/dhall-kubernetes/pull/120)
Would it be appropriate to add a configuration file to configure the output of the openapi-to-dhall command?
For example, a --config FilePath command line argument to set:
{ keep : List Text --| (empty means keep all)
, drop : List Text --| (empty means no keep all)
, namespace-keep: List Text
, namespace-drop: List Text
}
With such configuration file, we could start removing the kubernetes specific bits from the existing dhall-openapi implementation, for example https://github.com/dhall-lang/dhall-haskell/blob/715ba2a8dc2d8e6f19280a9a95863119442db312/dhall-openapi/src/Dhall/Kubernetes/Convert.hs#L282-L283 would be represented as
{ namespace-drop = ["io.k8s.kubernetes.pkg.api.", "io.k8s.kubernetes.pkg.apis."]
}
Is this a good idea?
Also note that the immediate need is to be able to select a list of object, and since that is a solution to implement the work-around for performance issues, perhaps a simpler [--keep object-name-prefix] command line argument would do the trick.
As a note, for this to be useful, if a package such as "io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" is in the list of --keep it should also bring all of its dependencies such as "io.k8s.apimachinery.pkg.apis.meta.v1.Time", ...
Also the list might be long so a dhall configuration file could be the way to go.