diff --git a/metadata-ingestion/scripts/modeldocgen.py b/metadata-ingestion/scripts/modeldocgen.py index ea7813f0ca85bc..ee5f06cb801baa 100644 --- a/metadata-ingestion/scripts/modeldocgen.py +++ b/metadata-ingestion/scripts/modeldocgen.py @@ -8,12 +8,12 @@ from dataclasses import Field, dataclass, field from enum import auto from pathlib import Path -from typing import Any, Dict, List, Optional, Tuple, Iterable +from typing import Any, Dict, Iterable, List, Optional, Tuple import avro.schema import click -from datahub.configuration.common import ConfigEnum, ConfigModel +from datahub.configuration.common import ConfigEnum, PermissiveConfigModel from datahub.emitter.mce_builder import make_data_platform_urn, make_dataset_urn from datahub.emitter.mcp import MetadataChangeProposalWrapper from datahub.emitter.rest_emitter import DatahubRestEmitter @@ -22,7 +22,9 @@ from datahub.ingestion.extractor.schema_util import avro_schema_to_mce_fields from datahub.ingestion.sink.file import FileSink, FileSinkConfig from datahub.metadata.schema_classes import ( + BrowsePathEntryClass, BrowsePathsClass, + BrowsePathsV2Class, DatasetPropertiesClass, DatasetSnapshotClass, ForeignKeyConstraintClass, @@ -34,8 +36,6 @@ StringTypeClass, SubTypesClass, TagAssociationClass, - BrowsePathsV2Class, - BrowsePathEntryClass, ) logger = logging.getLogger(__name__) @@ -493,30 +493,29 @@ def strip_types(field_path: str) -> str: ], ) + @dataclass class EntityAspectName: entityName: str aspectName: str -@dataclass -class AspectPluginConfig: +class AspectPluginConfig(PermissiveConfigModel): className: str enabled: bool - supportedEntityAspectNames: List[EntityAspectName] + supportedEntityAspectNames: List[EntityAspectName] = [] packageScan: Optional[List[str]] = None supportedOperations: Optional[List[str]] = None -@dataclass -class PluginConfiguration: +class PluginConfiguration(PermissiveConfigModel): aspectPayloadValidators: Optional[List[AspectPluginConfig]] = None mutationHooks: Optional[List[AspectPluginConfig]] = None mclSideEffects: Optional[List[AspectPluginConfig]] = None mcpSideEffects: Optional[List[AspectPluginConfig]] = None -class EntityRegistry(ConfigModel): +class EntityRegistry(PermissiveConfigModel): entities: List[EntityDefinition] events: Optional[List[EventDefinition]] plugins: Optional[PluginConfiguration] = None