From 501d662fc6901c94ab2e0810243abddad5e71a5c Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Sat, 15 May 2021 20:16:53 +0530 Subject: Do not convert YAML symbols from kebab case to camel case. Doing this conversion effectively forbids kebab case symbols in YAML. * ccwl/yaml.scm (kebab->camel): Delete function. (display-atom): Do not convert symbols from kebab case to camel case. * ccwl/ccwl.scm (make-workflow, output->cwl, command->cwl): Write camel case explicitly. --- ccwl/ccwl.scm | 24 ++++++++++++------------ ccwl/yaml.scm | 12 ++---------- 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/ccwl/ccwl.scm b/ccwl/ccwl.scm index f16a9e7..3869bb1 100644 --- a/ccwl/ccwl.scm +++ b/ccwl/ccwl.scm @@ -144,9 +144,9 @@ (define* (make-workflow steps outputs #:key (other '())) "Build a Workflow class CWL workflow." - `((cwl-version . ,%cwl-version) + `((cwlVersion . ,%cwl-version) (class . Workflow) - (requirements (Subworkflow-feature-requirement)) + (requirements (SubworkflowFeatureRequirement)) ,@other (inputs . ,(map (lambda (input) `(,(input-id input) @@ -172,9 +172,9 @@ (type . ,(match (output-type output) ('stdout 'File) (some-other-type some-other-type))) - (output-source . ,(match (output-source output) - ((? string? source) source) - ((? input? input) (input-id input)))))) + (outputSource . ,(match (output-source output) + ((? string? source) source) + ((? input? input) (input-id input)))))) outputs)) (steps . ,(map (lambda (step) `(,(step-id step) @@ -198,7 +198,7 @@ (list (and (output-type output) (cons 'type (output-type output))) (and (output-binding output) - (cons 'output-binding (output-binding output))))) + (cons 'outputBinding (output-binding output))))) ,@(output-other output))) (define-immutable-record-type @@ -226,15 +226,15 @@ position)) (command-args command) (iota (length (command-args command)))))) - `((cwl-version . ,%cwl-version) - (class . Command-line-tool) + `((cwlVersion . ,%cwl-version) + (class . CommandLineTool) ,@(command-other command) (arguments . ,(list->vector ;; Put string arguments into the arguments array. (filter-map (lambda (element) (and (string? (cli-element-argument element)) `((position . ,(cli-element-position element)) - (value-from . ,(cli-element-argument element))))) + (valueFrom . ,(cli-element-argument element))))) elements))) (inputs . ,(append ;; Put arguments into the inputs array. @@ -247,9 +247,9 @@ (label . ,(input-label input)) (default . ,(and (not (unspecified-default? (input-default input))) (input-default input))) - (input-binding . ,(filter-alist - `((position . ,(cli-element-position element)) - (prefix . ,(input-prefix input))))))) + (inputBinding . ,(filter-alist + `((position . ,(cli-element-position element)) + (prefix . ,(input-prefix input))))))) ,@(input-other input))))) elements) (map (lambda (input) diff --git a/ccwl/yaml.scm b/ccwl/yaml.scm index 19f26c2..256ba1d 100644 --- a/ccwl/yaml.scm +++ b/ccwl/yaml.scm @@ -33,19 +33,11 @@ #:export (scm->yaml scm->yaml-string)) -(define (kebab->camel string) - "Convert STRING from kebab case to CAMEL case." - (match (string-split string #\-) - ((head tail ...) - (string-concatenate - (cons head (map string-titlecase tail)))))) - (define (display-atom atom port) - "Display ATOM in PORT converting from kebab case to camel case if -ATOM is a symbol." + "Display ATOM in PORT." (cond ((symbol? atom) - (display (string->symbol (kebab->camel (symbol->string atom))) port)) + (display-atom (symbol->string atom) port)) ((number? atom) (display atom port)) ((string? atom) -- cgit v1.2.3