haive.core.schema.compatibility.mergersΒΆ
Schema merging strategies for combining multiple schemas.
ClassesΒΆ
How to resolve field conflicts during merge. |
|
Include only fields present in all schemas. |
|
Context for merge operations. |
|
Abstract base for merge strategies. |
|
Main schema merging engine. |
|
Include all fields from all schemas. |
FunctionsΒΆ
|
Create an intersection of multiple schemas. |
|
Create a union of multiple schemas. |
|
Merge multiple schemas using specified strategy. |
Module ContentsΒΆ
- class haive.core.schema.compatibility.mergers.ConflictResolution[source]ΒΆ
-
How to resolve field conflicts during merge.
Initialize self. See help(type(self)) for accurate signature.
- class haive.core.schema.compatibility.mergers.IntersectionMergeStrategy[source]ΒΆ
Bases:
MergeStrategy
Include only fields present in all schemas.
- merge_fields(field_infos, context)[source]ΒΆ
Merge field definitions.
- Parameters:
field_infos (list[tuple[str, haive.core.schema.compatibility.types.FieldInfo]])
context (MergeContext)
- Return type:
- class haive.core.schema.compatibility.mergers.MergeContext[source]ΒΆ
Context for merge operations.
Init .
- Returns:
Add return description]
- Return type:
[TODO
- class haive.core.schema.compatibility.mergers.MergeStrategy[source]ΒΆ
Bases:
abc.ABC
Abstract base for merge strategies.
- abstractmethod merge_fields(field_infos, context)[source]ΒΆ
Merge multiple field definitions.
- Parameters:
field_infos (list[tuple[str, haive.core.schema.compatibility.types.FieldInfo]])
context (MergeContext)
- Return type:
- class haive.core.schema.compatibility.mergers.SchemaMerger(strategy='union', analyzer=None, compatibility_checker=None)[source]ΒΆ
Main schema merging engine.
Init .
- Parameters:
strategy (MergeStrategy | str) β [TODO: Add description]
analyzer (haive.core.schema.compatibility.analyzer.TypeAnalyzer | None) β [TODO: Add description]
compatibility_checker (haive.core.schema.compatibility.compatibility.CompatibilityChecker | None) β [TODO: Add description]
- merge_schemas(schemas, name=None, base_class=None)[source]ΒΆ
Merge multiple schemas into one.
- Parameters:
schemas (list[type[pydantic.BaseModel] | haive.core.schema.compatibility.types.SchemaInfo]) β List of schemas to merge
name (str | None) β Name for the merged schema
base_class (type[pydantic.BaseModel] | None) β Base class for the merged schema
- Returns:
Merged schema class
- Return type:
type[pydantic.BaseModel]
- class haive.core.schema.compatibility.mergers.UnionMergeStrategy(conflict_resolution=ConflictResolution.LAST_WINS)[source]ΒΆ
Bases:
MergeStrategy
Include all fields from all schemas.
Init .
- Parameters:
conflict_resolution (ConflictResolution) β [TODO: Add description]
- merge_fields(field_infos, context)[source]ΒΆ
Merge field definitions.
- Parameters:
field_infos (list[tuple[str, haive.core.schema.compatibility.types.FieldInfo]])
context (MergeContext)
- Return type:
- haive.core.schema.compatibility.mergers.create_intersection_schema(*schemas, name=None)[source]ΒΆ
Create an intersection of multiple schemas.
- Parameters:
schemas (type[pydantic.BaseModel] | haive.core.schema.compatibility.types.SchemaInfo)
name (str | None)
- Return type:
type[pydantic.BaseModel]
- haive.core.schema.compatibility.mergers.create_union_schema(*schemas, name=None)[source]ΒΆ
Create a union of multiple schemas.
- Parameters:
schemas (type[pydantic.BaseModel] | haive.core.schema.compatibility.types.SchemaInfo)
name (str | None)
- Return type:
type[pydantic.BaseModel]