dhall-lang / dhall-haskell

Maintainable configuration files
https://dhall-lang.org/
BSD 3-Clause "New" or "Revised" License
917 stars 213 forks source link

dhall-openapi: configuration file rfc #2046

Open TristanCacqueray opened 4 years ago

TristanCacqueray commented 4 years ago

It seems like the openapi-to-dhall command could use some custom configuration:

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?

TristanCacqueray commented 4 years ago

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.

PierreR commented 4 years ago

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", ...

PierreR commented 4 years ago

Also the list might be long so a dhall configuration file could be the way to go.