Skip to content

Commit

Permalink
Merge branch 'main' into vampire/logic-consistency-test
Browse files Browse the repository at this point in the history
  • Loading branch information
krzema12 authored Jan 31, 2025
2 parents c27498b + 6331966 commit 9fd7b7b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import it.krzeminski.githubactionstyping.parsing.ApiItem
import it.krzeminski.githubactionstyping.validation.ItemValidationResult

fun ApiItem.validateEnum(): ItemValidationResult {
if (this.name?.isBlank() == true) {
return ItemValidationResult.Invalid("Name must not be empty.")
}
if (this.allowedValues == null) {
return ItemValidationResult.Invalid("Allowed values must be specified.")
}
Expand All @@ -19,5 +22,8 @@ fun ApiItem.validateEnum(): ItemValidationResult {
if (this.allowedValues.isEmpty()) {
return ItemValidationResult.Invalid("There must be at least one allowed value.")
}
if (this.allowedValues.any { it.isBlank() }) {
return ItemValidationResult.Invalid("Allowed values must not be empty.")
}
return ItemValidationResult.Valid
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ fun ApiItem.validateList(): ItemValidationResult {
if (this.listItem == null) {
return ItemValidationResult.Invalid("List item information must be specified.")
}
if (this.listItem.name?.isBlank() == true) {
return ItemValidationResult.Invalid("List item type: Name must not be empty.")
}
if (this.separator == null) {
return ItemValidationResult.Invalid("Separator must be specified.")
}
Expand Down

0 comments on commit 9fd7b7b

Please sign in to comment.