@@ -139,8 +139,14 @@ export function validateCustomVersionsFile(fileContents: string) {
139139 getLogger ( ) . info ( 'CodeTransformation: .YAML file must contain at least dependencies or plugins' )
140140 return `YAML file must contain at least \`dependencies\` or \`plugins\` under \`dependencyManagement\``
141141 }
142- for ( const item of dependenciesAndPlugins ) {
143- const errorMessage = validateItem ( item )
142+ for ( const item of dependencies ) {
143+ const errorMessage = validateItem ( item , false )
144+ if ( errorMessage ) {
145+ return errorMessage
146+ }
147+ }
148+ for ( const item of plugins ) {
149+ const errorMessage = validateItem ( item , true )
144150 if ( errorMessage ) {
145151 return errorMessage
146152 }
@@ -153,10 +159,15 @@ export function validateCustomVersionsFile(fileContents: string) {
153159}
154160
155161// return an error message, or undefined if item is valid
156- function validateItem ( item : any , validOriginTypes : string [ ] = [ 'FIRST_PARTY' , 'THIRD_PARTY' ] ) {
157- if ( ! / ^ [ ^ \s : ] + : [ ^ \s : ] + $ / . test ( item . identifier ) ) {
162+ function validateItem ( item : any , isPlugin : boolean ) {
163+ const validOriginTypes = [ 'FIRST_PARTY' , 'THIRD_PARTY' ]
164+ if ( ! isPlugin && ! / ^ [ ^ \s : ] + : [ ^ \s : ] + $ / . test ( item . identifier ) ) {
158165 getLogger ( ) . info ( `CodeTransformation: Invalid identifier format: ${ item . identifier } ` )
159- return `Invalid identifier format: \`${ item . identifier } \`. Must be in format \`groupId:artifactId\` without spaces`
166+ return `Invalid dependency identifier format: \`${ item . identifier } \`. Must be in format \`groupId:artifactId\` without spaces`
167+ }
168+ if ( isPlugin && ! item . identifier ?. trim ( ) ) {
169+ getLogger ( ) . info ( 'CodeTransformation: Missing identifier in plugin' )
170+ return 'Missing `identifier` in plugin'
160171 }
161172 if ( ! validOriginTypes . includes ( item . originType ) ) {
162173 getLogger ( ) . info ( `CodeTransformation: Invalid originType: ${ item . originType } ` )
0 commit comments