@@ -155,7 +155,7 @@ func (f *File) ToCommonParams() (*utils.CommonParams, error) {
155155 return params , nil
156156}
157157
158- func ValidateSpec (files []File , isTargetMandatory , isSearchBasedSpec , isUpload bool ) error {
158+ func ValidateSpec (files []File , isTargetMandatory , isSearchBasedSpec bool ) error {
159159 if len (files ) == 0 {
160160 return errors .New ("Spec must include at least one file group" )
161161 }
@@ -182,6 +182,7 @@ func ValidateSpec(files []File, isTargetMandatory, isSearchBasedSpec, isUpload b
182182 isRegexp := file .Regexp == "true"
183183 isAnt := file .Ant == "true"
184184 isExplode , _ := file .IsExplode (false )
185+ isTransitive , _ := file .IsTransitive (false )
185186
186187 if isTargetMandatory && ! isTarget {
187188 return errors .New ("Spec must include target." )
@@ -192,25 +193,26 @@ func ValidateSpec(files []File, isTargetMandatory, isSearchBasedSpec, isUpload b
192193 if isBuild && isBundle {
193194 return fileSpecValidationError ("build" , "bundle" )
194195 }
195- if isSearchBasedSpec {
196- if ! isAql && ! isPattern && ! isBuild && ! isBundle {
197- return errors .New ("Spec must include either aql, pattern, build or bundle." )
196+ if isSearchBasedSpec && ! isAql && ! isPattern && ! isBuild && ! isBundle {
197+ return errors .New ("Spec must include either aql, pattern, build or bundle." )
198+ }
199+ if isOffset {
200+ if isBuild {
201+ return fileSpecValidationError ("build" , "offset" )
198202 }
199- if isOffset {
200- if isBuild {
201- return fileSpecValidationError ("build" , "offset" )
202- }
203- if isBundle {
204- return fileSpecValidationError ("bundle" , "offset" )
205- }
203+ if isBundle {
204+ return fileSpecValidationError ("bundle" , "offset" )
206205 }
207- if isLimit {
208- if isBuild {
209- return fileSpecValidationError ("build" , "limit" )
210- }
211- if isBundle {
212- return fileSpecValidationError ("bundle" , "limit" )
213- }
206+ }
207+ if isTransitive && isOffset {
208+ return fileSpecValidationError ("transitive" , "offset" )
209+ }
210+ if isLimit {
211+ if isBuild {
212+ return fileSpecValidationError ("build" , "limit" )
213+ }
214+ if isBundle {
215+ return fileSpecValidationError ("bundle" , "limit" )
214216 }
215217 }
216218 if isAql && isPattern {
@@ -228,6 +230,9 @@ func ValidateSpec(files []File, isTargetMandatory, isSearchBasedSpec, isUpload b
228230 if isSortOrder && ! isValidSortOrder {
229231 return errors .New ("The value of 'sort-order' can only be 'asc' or 'desc'." )
230232 }
233+ if isTransitive && isSortBy {
234+ return fileSpecValidationError ("transitive" , "sort-by" )
235+ }
231236 if ! isBuild && (isExcludeArtifacts || isIncludeDeps ) {
232237 return errors .New ("Spec cannot include 'exclude-artifacts' or 'include-deps' if 'build' is not included." )
233238 }
@@ -248,5 +253,5 @@ func ValidateSpec(files []File, isTargetMandatory, isSearchBasedSpec, isUpload b
248253}
249254
250255func fileSpecValidationError (fieldA , fieldB string ) error {
251- return errors .New (fmt .Sprintf ("Spec cannot include both '%s' and '%s.' " , fieldA , fieldB ))
256+ return errors .New (fmt .Sprintf ("Spec cannot include both '%s' and '%s'. " , fieldA , fieldB ))
252257}
0 commit comments