Connection Validation Service
Relevant source files
The following files were used as context for generating this wiki page:
- src/flext_oracle_oic/_utilities/connection_validation.py
- src/flext_oracle_oic/constants.py
- src/flext_oracle_oic/ext_client.py
- src/flext_oracle_oic/services/integration_lifecycle.py
- src/flext_oracle_oic/models.py (Referenced via tests/unit/test_models.py)
- src/flext_oracle_oic/settings.py (Referenced via tests/unit/test_config.py)
The Connection Validation Service is a core utility within the flext-oracle-oic extension designed to ensure the integrity and validity of Oracle Integration Cloud (OIC) connection parameters. It provides a robust mechanism for checking structural data, such as base URLs, as well as validating specific integration domain values like connection statuses and types against canonical sets defined in the project's constants.
Sources: src/flext_oracle_oic/_utilities/connection_validation.py:1-10, src/flext_oracle_oic/constants.py:1-15
Architecture and Components
The service is primarily implemented as a mixin class, FlextOracleOicUtilitiesConnectionValidation, which centralizes validation logic used by both the API client and high-level services. It relies on the project's Result pattern (p.Result) for railway-oriented error handling, returning either a success container with the validated value or a failure container with descriptive error messages.
Core Validation Logic Flow
The following diagram illustrates how a connection parameter is processed through the validation utilities.
The validation process ensures that inputs are not only of the correct type but also adhere to business rules defined for the OIC environment.
Sources: src/flext_oracle_oic/_utilities/connection_validation.py:10-50, src/flext_oracle_oic/constants.py:180-210
Key Validation Methods
The service exposes specialized methods for different aspects of OIC connection metadata.
URL Validation
The validate_base_url method ensures that the OIC endpoint is a non-empty string and uses a secure protocol (http:// or https://).
Sources: src/flext_oracle_oic/_utilities/connection_validation.py:35-58
Closed-Set Validation
Many OIC parameters must match a specific set of allowed values. The private method _validate_closed_string handles this by normalizing the input (upper-casing and stripping whitespace) before comparing it against a frozenset of valid values.
Sources: src/flext_oracle_oic/_utilities/connection_validation.py:13-33
| Method | Field Label | Valid Values Reference |
|---|---|---|
validate_connection_status | "Connection status" | c.OracleOicValidation.VALID_CONNECTION_STATUSES |
validate_connection_type | "Connection type" | c.OracleOicValidation.VALID_CONNECTION_TYPES |
Sources: src/flext_oracle_oic/_utilities/connection_validation.py:60-84, src/flext_oracle_oic/constants.py:199-215
Integration and Usage
The Validation Service is utilized during the initialization of the FlextOracleOicClient and when testing active connections.
Connection Testing Flow
When testing a connection, the service interacts with the OIC health API and validates the returned status.
Validation Constants
The validation logic is driven by the FlextOracleOicConstants class, which defines the authoritative sets of valid statuses and types.
| Constant Category | Values |
|---|---|
| Valid Connection Statuses | ACTIVE, INACTIVE, ERROR, unknown |
| Valid Connection Types | REST, SOAP, DATABASE, FILE, FTP, SFTP |
| URL Requirements | Must start with http:// or https:// |
Sources: src/flext_oracle_oic/constants.py:204-215, src/flext_oracle_oic/_utilities/connection_validation.py:56
Conclusion
The Connection Validation Service provides a critical safety layer for the flext-oracle-oic project. By enforcing strict type checking and domain-specific value constraints, it ensures that only valid configuration data reaches the Oracle Integration Cloud APIs, thereby reducing runtime errors and improving system reliability.