Data Models & Typings
Relevant source files
The following files were used as context for generating this wiki page:
The Data Models and Typings in the flext-oracle-wms library provide the foundation for type-safe interaction with the Oracle Warehouse Management System (WMS) Cloud. These models are built using Clean Architecture principles and Domain-Driven Design (DDD), leveraging Pydantic for data validation and FLEXT core patterns for consistency across the ecosystem.
The scope of this module includes defining the domain entities (such as inventory items and shipments), API endpoint structures, and authentication settings required for secure communication with Oracle WMS Cloud. By using these models, the library ensures that data flowing between the integration platform and the WMS adheres to strict schema definitions and business rules.
Sources: src/flext_oracle_wms/models.py:1-25, src/flext_oracle_wms/README.md:25-30
Core Domain Models
The library implements a hierarchy of domain models under the FlextOracleWmsModels class, organized into specific namespaces for clarity and modularity.
WMS Entity Infrastructure
The base infrastructure defines how Oracle WMS entities are represented. This includes the Entity model, which maps WMS objects to API endpoints and defines replication strategies for data pipelines.
The diagram shows the relationship between the base entity definition used for discovery and the actual domain entities used for data processing.
Sources: src/flext_oracle_wms/models.py:32-75, src/flext_oracle_wms/models.py:133-145
Domain Entities
Specific models represent standard WMS objects. These models inherit from WmsEntity and include fields relevant to warehouse operations.
| Entity | Description | Key Fields |
|---|---|---|
| InventoryItem | Represents a stock keeping unit (SKU) in the warehouse. | sku, quantity, location_id, status |
| Shipment | Represents an outbound shipment associated with an order. | order_id, status, carrier, tracking_number |
| Location | Defines a specific storage position within the facility. | aisle, shelf, bin_, zone |
Sources: src/flext_oracle_wms/models.py:147-178
API & Infrastructure Models
Infrastructure models facilitate the interaction with the Oracle WMS REST API (LGF API), covering endpoint definitions and authentication configurations.
Authentication Settings
The AuthSettings model supports multiple authentication methods required by Oracle Cloud, including Basic Auth and OAuth2. It includes business logic validation to ensure required credentials are provided for each method.
This flowchart illustrates the logic within the validate_business_rules method of the AuthSettings class.
Sources: src/flext_oracle_wms/models.py:90-115
API Catalog Models
The ApiEndpoint model provides a typed definition for declarative API management.
| Field | Type | Description |
|---|---|---|
name | str | Unique identifier for the API endpoint. |
method | str | HTTP method (GET, POST, etc.). |
path | str | Relative path of the API endpoint. |
version | str | The API version (e.g., v10). |
category | str | Logical grouping (e.g., Inventory, Orders). |
Sources: src/flext_oracle_wms/models.py:77-88
Data Validation and Business Logic
Validation is performed at multiple levels: Pydantic field validation for type/length and manual domain validation for complex business rules.
Validation Examples
- Endpoint Pattern: The
Entitymodel enforces that endpoints must start with a forward slash (/). - Entity Names: The domain service restricts entity names to a maximum length of 50 characters.
- Auth Consistency: Prevents initialization of an OAuth2 flow if client credentials are missing.
# From src/flext_oracle_wms/models.py
@u.field_validator("endpoint")
@classmethod
def _validate_endpoint_starts_with_slash(cls, v: str) -> str:
if not v.startswith("/"):
msg = "Endpoint must start with '/'"
raise ValueError(msg)
return v
Sources: src/flext_oracle_wms/models.py:60-66, tests/unit/test_singer_flattening.py:34-45
Type Aliases and Exports
The module uses a specialized export system for lazy loading and type safety, defined in the package initialization.
| Alias | Target | Purpose |
|---|---|---|
m | FlextOracleWmsModels | Convenient shorthand for accessing all domain models. |
c | FlextOracleWmsConstants | Access to WMS-specific constants and enums. |
t | FlextOracleWmsTypes | Standardized type aliases for mapping and sequences. |
p | FlextOracleWmsProtocols | Protocol definitions for interface adherence. |
Sources: src/flext_oracle_wms/init.py:35-65
Conclusion
The Data Models & Typings module provides the structural integrity required for Oracle WMS Cloud integrations. By centralizing entity definitions, API structures, and validation logic into a type-safe domain layer, the system ensures reliable data exchange while maintaining compliance with FLEXT ecosystem standards.