@@ -4,7 +4,9 @@ import _root_.io.circe.yaml
4
4
import akka .util .ByteString
5
5
import cats .data .NonEmptyList
6
6
import cats .data .Validated .{Invalid , Valid }
7
+ import cats .instances .option ._
7
8
import cats .syntax .apply ._
9
+ import cats .syntax .functor ._
8
10
import cats .syntax .validated ._
9
11
import common .validation .ErrorOr .ErrorOr
10
12
import common .validation .Validation ._
@@ -68,12 +70,27 @@ object PartialWorkflowSources {
68
70
// workflow source
69
71
val wdlSource = getStringValue(WdlSourceKey )
70
72
val workflowSource = getStringValue(WorkflowSourceKey )
71
- val wdlSourceWarning = wdlSource.map(_ => wdlSourceDeprecationWarning)
73
+
74
+ def deprecationWarning (out : String , in : String )(actual : String ): String = {
75
+ if (actual == out) {
76
+ val warning =
77
+ Array (
78
+ s " The ' $out' parameter name has been deprecated in favor of ' $in'. " ,
79
+ s " Support for ' $out' will be removed from future versions of Cromwell. " ,
80
+ s " Please switch to using ' $in' in future submissions. " ).mkString(" " )
81
+ log.warn(warning)
82
+ warning
83
+ } else " "
84
+ }
85
+
86
+ val wdlSourceDeprecationWarning : String => String = deprecationWarning(out = WdlSourceKey , in = WorkflowSourceKey )
87
+ val wdlSourceWarning = wdlSource.as(WdlSourceKey ) map wdlSourceDeprecationWarning
88
+
72
89
val workflowSourceFinal : ErrorOr [String ] = (wdlSource, workflowSource) match {
73
90
case (Some (source), None ) => source.validNel
74
91
case (None , Some (source)) => source.validNel
75
- case (Some (_), Some (_)) => " wdlSource and workflowSource can't both be supplied" .invalidNel
76
- case (None , None ) => " workflowSource needs to be supplied" .invalidNel
92
+ case (Some (_), Some (_)) => s " $WdlSourceKey and $WorkflowSourceKey can't both be supplied " .invalidNel
93
+ case (None , None ) => s " $WorkflowSourceKey needs to be supplied " .invalidNel
77
94
}
78
95
79
96
// workflow inputs
@@ -90,11 +107,14 @@ object PartialWorkflowSources {
90
107
// dependencies
91
108
val wdlDependencies = getArrayValue(WdlDependenciesKey )
92
109
val workflowDependencies = getArrayValue(WorkflowDependenciesKey )
93
- val wdlDependenciesWarning = wdlDependencies.map(_ => wdlDependenciesDeprecationWarning)
110
+
111
+ val wdlDependenciesDeprecationWarning : String => String = deprecationWarning(out = " wdlDependencies" , in = " workflowDependencies" )
112
+ val wdlDependenciesWarning = wdlDependencies.as(WdlDependenciesKey ) map wdlDependenciesDeprecationWarning
113
+
94
114
val workflowDependenciesFinal : ErrorOr [Option [Array [Byte ]]] = (wdlDependencies, workflowDependencies) match {
95
115
case (Some (dep), None ) => Option (dep).validNel
96
116
case (None , Some (dep)) => Option (dep).validNel
97
- case (Some (_), Some (_)) => " wdlDependencies and workflowDependencies can't both be supplied" .invalidNel
117
+ case (Some (_), Some (_)) => s " $WdlDependenciesKey and $WorkflowDependenciesKey can't both be supplied " .invalidNel
98
118
case (None , None ) => None .validNel
99
119
}
100
120
@@ -177,20 +197,6 @@ object PartialWorkflowSources {
177
197
case Invalid (err) => err.invalid
178
198
}
179
199
}
180
-
181
- private val wdlSourceDeprecationWarning = deprecationWarning(out = " wdlSource" , in = " workflowSource" )
182
- private val wdlDependenciesDeprecationWarning = deprecationWarning(out = " wdlDependencies" , in = " workflowDependencies" )
183
-
184
- private def deprecationWarning (out : String , in : String ): String = {
185
- val warning =
186
- s """
187
- |The ' $out' parameter name has been deprecated in favor of ' $in'.
188
- |Support for ' $out' will be removed from future versions of Cromwell.
189
- |Please switch to using ' $in' in future submissions.
190
- """ .stripMargin
191
- log.warn(warning)
192
- warning
193
- }
194
200
195
201
def mergeMaps (allInputs : Seq [Option [String ]]): JsObject = {
196
202
val convertToMap = allInputs.map(x => toMap(x))
0 commit comments