io.enterpriseai.contracts.ContractValidator
Source: sdks/java/enterprise-ai-java/src/main/java/io/enterpriseai/contracts/ContractValidator.java. Back to the Java SDK reference index.
This page is generated by tools/docs/gen_sdk_reference.py from the SDK sources and the OpenAPI text folders. Do not edit it by hand: change the source and regenerate.
Class ContractValidator
Client side validation against the embedded copy of contracts/v1 (JSON Schema 2020-12). Manifests are detected by kind (Agent, Model, Tool, Skill, Plugin, Connector, Channel, ManagedComponent).
Attributes:
| Name | Type | Required | Description |
|---|---|---|---|
BASE_URI | String | yes | Base URI of the schemas, https://schemas.enterprise-ai.io/v1/, mapped to the embedded copies. |
Constructor ContractValidator
ContractValidator(Locale locale)
Creates a validator that reads the embedded contract index and writes its messages in the given language.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
locale | Locale | yes | Language of the validation error messages, for example Locale.FRENCH. |
ContractValidator.contracts
List<String> contracts()
Contract names known by the embedded index.
This element takes no parameter.
Returns: List<String>. The unmodifiable list of contract names, such as tool-manifest.
ContractValidator.schema
JsonNode schema(String name)
Reads the embedded JSON Schema of a contract.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
name | String | yes | Name of a contract of the index; an unknown name raises IllegalArgumentException. |
Returns: JsonNode. The JSON Schema of the contract, as a JsonNode.
Raises: IllegalStateException.
ContractValidator.validate
ValidationResult validate(String name, Object document)
Validates any value (JsonNode, Map, record) against a named contract.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
name | String | yes | Name of the contract, such as tool-manifest; an unknown name raises IllegalArgumentException. | |
document | Object | yes | Value to validate: a JsonNode, a Map or a record converted to JSON. |
Returns: ValidationResult. A ValidationResult: Result of a contract validation.
ContractValidator.validateManifest
ValidationResult validateManifest(Object manifest)
Validates a manifest, picking the contract from its kind.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
manifest | Object | yes | Manifest to validate; its kind picks the contract, an unknown kind gives an invalid result for the unknown contract. |
Returns: ValidationResult. A ValidationResult: Result of a contract validation.