about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ccwl/cwl.scm9
-rw-r--r--tests/cwl.scm16
2 files changed, 21 insertions, 4 deletions
diff --git a/ccwl/cwl.scm b/ccwl/cwl.scm
index baef519..0f600ca 100644
--- a/ccwl/cwl.scm
+++ b/ccwl/cwl.scm
@@ -1,5 +1,5 @@
 ;;; ccwl --- Concise Common Workflow Language
-;;; Copyright © 2021, 2023–2024 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2021, 2023–2025 Arun Isaac <arunisaac@systemreboot.net>
 ;;;
 ;;; This file is part of ccwl.
 ;;;
@@ -136,10 +136,13 @@ CWL YAML specification."
   "Render @var{input}, a @code{<input>} object, into a CWL tree."
   `(,(input-id input)
     (type . ,(type->cwl (input-type input)))
+    ;; The default property is special because a value of #f is
+    ;; meaningful and must be serialized.
+    ,@(if (unspecified-default? (input-default input))
+          '()
+          `((default . ,(input-default input))))
     ,@(or (filter-alist
            `((label . ,(input-label input))
-             (default . ,(and (not (unspecified-default? (input-default input)))
-                              (input-default input)))
              ;; inputBinding is only relevant to commands, not
              ;; workflows. But, the input position and prefix are not set
              ;; for worklow inputs and therefore this sub-expression has
diff --git a/tests/cwl.scm b/tests/cwl.scm
index ba619ab..8009a2e 100644
--- a/tests/cwl.scm
+++ b/tests/cwl.scm
@@ -1,5 +1,5 @@
 ;;; ccwl --- Concise Common Workflow Language
-;;; Copyright © 2023 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2023, 2025 Arun Isaac <arunisaac@systemreboot.net>
 ;;;
 ;;; This file is part of ccwl.
 ;;;
@@ -18,6 +18,12 @@
 
 (use-modules (srfi srfi-64))
 
+(define make-input
+  (@@ (ccwl ccwl) make-input))
+
+(define input->cwl-scm
+  (@@ (ccwl cwl) input->cwl-scm))
+
 (define type->cwl
   (@@ (ccwl cwl) type->cwl))
 
@@ -41,4 +47,12 @@
               (items . File))))
   (type->cwl (make-array-type (make-array-type 'File))))
 
+(test-equal "Serialize #f defaults in input values"
+  '("foo"
+    (type . boolean)
+    (default . #f)
+    (label . "foo"))
+  (input->cwl-scm
+   (make-input "foo" 'boolean "foo" #f #f #f #f '())))
+
 (test-end "cwl")