Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package com.embabel.agent.spi.validation

import com.embabel.agent.core.AgentScope
import com.embabel.common.core.validation.ValidationResult

interface AgentValidationManager {
fun validate(agentScope: AgentScope): ValidationResult
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package com.embabel.agent.spi.validation

import com.embabel.agent.core.AgentScope
import com.embabel.common.core.validation.ValidationResult

fun interface AgentValidator {

Expand All @@ -31,36 +32,3 @@ fun interface AgentStructureAgentValidator : AgentValidator {
}

interface PathToCompletionAgentValidator : AgentValidator

data class ValidationResult(
val isValid: Boolean,
val errors: List<ValidationError>,
) {

companion object {
val VALID = ValidationResult(
isValid = true,
errors = emptyList(),
)
}
}

data class ValidationError(
val code: String,
val message: String,
val severity: ValidationSeverity,
val location: ValidationLocation,
)

enum class ValidationSeverity {
ERROR,
WARNING,
INFO
}

data class ValidationLocation(
val type: String,
val name: String,
val agentName: String,
val component: String,
)
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ import com.embabel.agent.api.annotation.Action
import com.embabel.agent.api.annotation.Agent
import com.embabel.agent.api.annotation.Condition
import com.embabel.agent.core.AgentScope
import com.embabel.common.core.validation.ValidationError
import com.embabel.common.core.validation.ValidationLocation
import com.embabel.common.core.validation.ValidationResult
import com.embabel.common.core.validation.ValidationSeverity
import com.embabel.common.util.loggerFor
import org.springframework.beans.factory.InitializingBean
import org.springframework.beans.factory.getBeansWithAnnotation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package com.embabel.agent.spi.validation

import com.embabel.agent.core.AgentScope
import com.embabel.common.core.validation.ValidationResult
import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/
package com.embabel.agent.spi.validation

import com.embabel.common.core.validation.ValidationResult

data class DetailedValidationResult(
val isValid: Boolean,
val results: Map<AgentValidator, ValidationResult>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ package com.embabel.agent.spi.validation

import com.embabel.agent.core.AgentScope
import com.embabel.agent.core.support.Rerun.HAS_RUN_CONDITION_PREFIX
import com.embabel.common.core.validation.ValidationError
import com.embabel.common.core.validation.ValidationLocation
import com.embabel.common.core.validation.ValidationResult
import com.embabel.common.core.validation.ValidationSeverity
import com.embabel.plan.common.condition.ConditionAction
import com.embabel.plan.common.condition.ConditionDetermination
import com.embabel.plan.common.condition.ConditionGoal
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright 2024-2026 Embabel Pty Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.embabel.common.core.validation

data class ValidationError(
val code: String,
val message: String,
val severity: ValidationSeverity,
val location: ValidationLocation,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright 2024-2026 Embabel Pty Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.embabel.common.core.validation

data class ValidationLocation(
val type: String,
val name: String,
val agentName: String,
val component: String,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright 2024-2026 Embabel Pty Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.embabel.common.core.validation

data class ValidationResult(
val isValid: Boolean,
val errors: List<ValidationError>,
) {

companion object {
val VALID = ValidationResult(
isValid = true,
errors = emptyList(),
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright 2024-2026 Embabel Pty Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.embabel.common.core.validation

enum class ValidationSeverity {
ERROR,
CRITICAL,
WARNING,
INFO
}
Loading