Hi,
I’ve tried to generate dhall bindings for traefik using openapi-to-dhall
. They provide CRDs here: https://github.com/traefik/traefik/blob/v2.5/docs/content/reference/dynamic-configuration/kubernetes-crd-definition-v1.yml
I’ve looked at how dhall-kubernetes is generated, but this didn’t help much, there are the following key differences:
- K8 provides a single swagger file, while there are 9 files for Traefik. This affects top-level files like
schemas.dhall
- they are overwritten for each file; - K8 schema provides more fine-grained types.
As a result I get 9 huge types almost without defaults. Sample default: { apiVersion = "v1alpha1", kind = "TLSOption" }
I’ve been able to “fix” dhall files for traefik.containo.us.Middleware.dhall, but this required manually splitting 12 type files and 2 default and schema files. This might work for a single release, but will be very hard to support over future releases. Sample test file - https://github.com/K0Te/dhall-traefik-k8/blob/main/2.5/Test.dhall
Am I misusing openapi-to-dhall
? Or is it just a poor schema that should be improved?
I’ve used the following commands:
for file in `ls ../source/`; do echo $file; yaml-to-dhall --file ../source/$file | dhall-to-json > $file ; done
for file in `ls work`; do openapi-to-dhall --crd work/$file; done