Commit Graph

10 Commits

Author SHA1 Message Date
Gabriella Gonzalez
753c7d04fb
Add support for Kubernetes versions 1.{23,24,25} and change default (#186) 2022-08-25 08:58:00 -07:00
Gabriel Gonzalez
170c6e86fc
Fix top-level examples (#129) 2020-07-14 07:51:57 -07:00
Gabriel Gonzalez
381306bcc3
Go back to using --omitNull instead of --omitEmpty (#110)
Fixes https://github.com/dhall-lang/dhall-kubernetes/issues/86

The motivation of this is to more accurately model the Kubernetes
API semantics by not auto-omitting empty fields.  This is because
a field set to `Some ([] : List T)` is not necessarily the same
as `None (List T)`.

This makes the typical case a bit more verbose (more `Some`s), but
the difference to the `./examples` shows that it's not too bad.
2020-01-31 06:52:20 -08:00
Gabriel Gonzalez
90c1eb8851
Minimize unnecessary rebuilds (#105)
This improves the granularity of the Nix build graph in order to minimize
unnecessary rebuilds.

This also fixed several bugs in the package generation along the way, so
this change includes those fixes.
2020-01-14 07:35:36 -08:00
Greg Ziegan
7af2ab5345 Prefer "schema" syntax for examples (#93)
* Also update to the latest version of `dhall`
* Also fix `./scripts/generate.sh` to generate the `schemas*` files
2019-11-23 16:53:03 -08:00
Fabrizio Ferrai
4ad58156b7
Update to Kubernetes 1.14.3 (#72) 2019-07-30 10:25:00 +03:00
Fabrizio Ferrai
805b432df2
API v2 (#57)
This ports the conversion script from Python to Haskell (fix #7)

The main reasons for this port are that:
- the Python script was really hard to maintain for reasons like 
  "converting from Swagger to Dhall is interleaved with string formatting"
- in Haskell we can use the dhall library to generate always syntactically 
  correct Dhall AST. It's also much easier to keep an eye on correctness, 
  because types and pattern matching. It also forces us to deal with things
  like cyclic imports from the get go.

Things happening here:
- remove the `api` folder, removing the difference between "raw api" and "nice api"
- move defaults from `default` to `defaults` folder, as it is in `dhall-nethack`
- transition to the new syntax for `Optional` (fix #49)
- add `types.dhall` and `defaults.dhall`, so that one can now easily "pin a version"
  by just importing these two records at a specific commit/tag. They also make it really
  easy to access objects, e.g.
  `let types = https://raw.githubusercontent... sha256:... in types.Deployment`
- also add typesUnion.dhall (fix #54), so one is able to send to Kubernetes different
  objects in the same stream. This is also documented in the README
- defaults are resolved recursively (fix #46): if there's an import of a "nullable" record,
  then it's not marked as Optional, making merging objects much easier
- default objects are not lambdas anymore, and instead they just don't include the required
  fields (that is, the ones that are not nullable records), as suggested in dhall-lang/dhall-lang#382
- for objects that are simple types we used to generate a simple lambda
  `\(a : Text) -> a` as a default, now we just don't generate a default (e.g. see
  `io.k8s.apimachinery.pkg.apis.meta.v1.Time`)
- autoformat all generated Dhall code
- remove cyclic imports (fix #47)
- update to dhall-1.22 and dhall-json-1.2.8
2019-05-01 19:13:18 +03:00
Fabrizio Ferrai
f8be1d55bc
Add high level API (#34)
This adds a high level API (+ tests) for:
- Deployment.v1
- Service.v1
2018-09-13 13:33:48 +03:00
Fabrizio Ferrai
4fec2167a8
Support 'format' key from the swagger schema (#28)
Fix #12 by introducing a `< Int : Natural | String : Text >` Union for the "int-or-string" format key.
2018-08-06 17:13:33 +02:00
Thomas Scholtes
4a7f02cd0d Extract and check examples (#27)
* We move all the example code from the readme to the `examples` folder.
* We provide a `scripts/build-readme.sh` script that inlines referenced
  examples in `README.md.in` and outputs `README.md`. The script also
  verifies that the output readme is the same as in version control.
* We provide a `scripts/build-examples.py` script that builds the Yaml
  output for all examples. The script also verifies that the generated
  Yaml files are the same as in version control.
2018-08-03 16:24:32 +02:00