diff --git a/src/fmu/dataio/_metadata.py b/src/fmu/dataio/_metadata.py index 3cb807a9b..30def6d88 100644 --- a/src/fmu/dataio/_metadata.py +++ b/src/fmu/dataio/_metadata.py @@ -39,7 +39,7 @@ def _get_meta_filedata( ).get_metadata() -def _get_meta_fmu(fmudata: FmuProvider) -> schema.InternalFMU | None: +def _get_meta_fmu(fmudata: FmuProvider) -> fields.FMU | None: try: return fmudata.get_metadata() except InvalidMetadataError: diff --git a/src/fmu/dataio/_model/schema.py b/src/fmu/dataio/_model/schema.py index 0a35cfc0b..afda9331a 100644 --- a/src/fmu/dataio/_model/schema.py +++ b/src/fmu/dataio/_model/schema.py @@ -111,10 +111,6 @@ class JsonSchemaMetadata(BaseModel): source: str = Field(default=SOURCE, frozen=True) -class Context(BaseModel, use_enum_values=True): - stage: enums.FMUContext - - # Remove the two models below when content is required as input. class InternalUnsetData(data.Data): content: Literal["unset"] # type: ignore @@ -132,12 +128,6 @@ def _deprecation_warning(self) -> InternalUnsetData: return self -class InternalFMU(fields.FMU): - # This class is identical to the one used in the schema - # except for more fmu context values being allowed internally - context: Context # type: ignore - - class InternalObjectMetadata(JsonSchemaMetadata, populate_by_name=True): # TODO: aim to use root.ObjectMetadata as base # class and disallow creating invalid metadata. @@ -152,7 +142,7 @@ class InternalObjectMetadata(JsonSchemaMetadata, populate_by_name=True): enums.FMUClass.points, enums.FMUClass.dictionary, ] = Field(alias="class") - fmu: Optional[InternalFMU] + fmu: Optional[fields.FMU] masterdata: Optional[fields.Masterdata] access: Optional[fields.SsdlAccess] data: Union[InternalUnsetData, data.AnyData] # keep InternalUnsetData first here diff --git a/src/fmu/dataio/providers/_fmu.py b/src/fmu/dataio/providers/_fmu.py index f7abc233e..fe67a6b0d 100644 --- a/src/fmu/dataio/providers/_fmu.py +++ b/src/fmu/dataio/providers/_fmu.py @@ -168,7 +168,7 @@ def get_runpath(self) -> Path | None: """Return runpath for a FMU run.""" return self._runpath - def get_metadata(self) -> schema.InternalFMU: + def get_metadata(self) -> fields.FMU: """Construct the metadata FMU block for an ERT forward job.""" logger.debug("Generate ERT metadata...") @@ -178,7 +178,7 @@ def get_metadata(self) -> schema.InternalFMU: case_meta = self._get_case_meta() if self.fmu_context != FMUContext.realization: - return schema.InternalFMU( + return fields.FMU( case=case_meta.fmu.case, context=self._get_fmucontext_meta(), model=self.model or case_meta.fmu.model, @@ -189,7 +189,7 @@ def get_metadata(self) -> schema.InternalFMU: iter_uuid, real_uuid = self._get_iteration_and_real_uuid( case_meta.fmu.case.uuid ) - return schema.InternalFMU( + return fields.FMU( case=case_meta.fmu.case, context=self._get_fmucontext_meta(), model=self.model or case_meta.fmu.model, @@ -326,8 +326,8 @@ def _get_iteration_meta(self, iter_uuid: UUID) -> fields.Iteration: else None, ) - def _get_fmucontext_meta(self) -> schema.Context: - return schema.Context(stage=self.fmu_context) + def _get_fmucontext_meta(self) -> fields.Context: + return fields.Context(stage=self.fmu_context) def _get_workflow_meta(self) -> fields.Workflow: assert self.workflow is not None