loadVarStep.dhall 884 B

12345678910111213141516171819202122232425262728293031323334
  1. let Types = ../types/package.dhall
  2. let RenderOptional = ./optionals/package.dhall
  3. let JSON = (../lib/prelude.dhall).JSON
  4. let renderFormat =
  5. λ(f : Types.LoadVarFormat) →
  6. JSON.string
  7. ( merge
  8. { detect = "detect"
  9. , json = "json"
  10. , yaml = "yaml"
  11. , yml = "yml"
  12. , raw = "raw"
  13. }
  14. f
  15. )
  16. let render
  17. : Types.LoadVarStep → Types.JSONObject
  18. = λ(l : Types.LoadVarStep) →
  19. toMap
  20. { load_var = JSON.string l.var
  21. , file = JSON.string l.file
  22. , format =
  23. RenderOptional.generic Types.LoadVarFormat renderFormat l.format
  24. , tags = RenderOptional.lists.text l.tags
  25. , timeout = RenderOptional.text l.timeout
  26. , attempts = RenderOptional.natural l.attempts
  27. }
  28. in render