From 90975484e6e1e5521ac6fa9eb6be8d04eaafbb8e Mon Sep 17 00:00:00 2001 From: Gerda Shank Date: Wed, 30 Aug 2023 14:06:59 -0400 Subject: [PATCH] Convert to using mashumaro jsonschema with acceptable performance (#8437) --- .../Under the Hood-20230718-145428.yaml | 6 + core/dbt/context/context_config.py | 14 +- core/dbt/contracts/connection.py | 17 +- core/dbt/contracts/graph/model_config.py | 44 +- core/dbt/contracts/graph/nodes.py | 36 +- core/dbt/contracts/graph/unparsed.py | 23 +- core/dbt/contracts/project.py | 62 +- core/dbt/contracts/util.py | 21 +- core/dbt/dataclass_schema.py | 184 +- core/dbt/helper_types.py | 70 +- core/dbt/parser/base.py | 1 + core/dbt/utils.py | 1 + core/setup.py | 4 +- dev-requirements.txt | 1 + .../dbt/adapters/postgres/connections.py | 5 +- schemas/dbt/catalog/v1.json | 264 +- schemas/dbt/manifest/v11.json | 5055 +++++++++-------- schemas/dbt/run-results/v4.json | 370 +- schemas/dbt/sources/v3.json | 311 +- .../artifacts/test_docs_generate_defer.py | 11 +- tests/functional/configs/test_configs.py | 2 +- .../test_custom_node_colors_configs.py | 2 +- .../functional/configs/test_disabled_model.py | 2 +- .../exposures/test_exposure_configs.py | 2 +- .../functional/metrics/test_metric_configs.py | 2 +- .../functional/sources/test_source_configs.py | 2 +- .../sources/test_source_fresher_state.py | 5 + tests/unit/test_contracts_graph_parsed.py | 36 - tests/unit/test_contracts_graph_unparsed.py | 12 - tests/unit/test_graph.py | 10 - tests/unit/test_postgres_adapter.py | 5 + tests/unit/test_query_headers.py | 4 + third-party-stubs/mashumaro/__init__.pyi | 2 - third-party-stubs/mashumaro/config.pyi | 39 +- third-party-stubs/mashumaro/core/const.pyi | 24 +- third-party-stubs/mashumaro/core/helpers.pyi | 7 + .../mashumaro/core/meta/builder.pyi | 115 - .../{dialects => core/meta/code}/__init__.pyi | 0 .../mashumaro/core/meta/code/builder.pyi | 146 + .../mashumaro/core/meta/code/lines.pyi | 8 + .../mashumaro/core/meta/helpers.pyi | 77 +- .../mashumaro/core/meta/mixin.pyi | 13 + .../mashumaro/core/meta/patch.pyi | 1 - .../mashumaro/core/meta/types/__init__.pyi | 0 .../mashumaro/core/meta/types/common.pyi | 67 + .../mashumaro/core/meta/types/pack.pyi | 3 + .../mashumaro/core/meta/types/unpack.pyi | 34 + third-party-stubs/mashumaro/dialect.pyi | 7 +- .../mashumaro/dialects/msgpack.pyi | 5 - third-party-stubs/mashumaro/exceptions.pyi | 88 +- third-party-stubs/mashumaro/helper.pyi | 15 +- .../mashumaro/jsonschema/__init__.pyi | 2 + .../mashumaro/jsonschema/annotations.pyi | 80 + .../mashumaro/jsonschema/builder.pyi | 31 + .../mashumaro/jsonschema/dialects.pyi | 22 + .../mashumaro/jsonschema/models.pyi | 243 + .../mashumaro/jsonschema/schema.pyi | 72 + third-party-stubs/mashumaro/mixins/dict.pyi | 4 +- third-party-stubs/mashumaro/mixins/json.pyi | 3 +- .../mashumaro/mixins/msgpack.pyi | 19 +- third-party-stubs/mashumaro/mixins/orjson.pyi | 23 + third-party-stubs/mashumaro/mixins/toml.pyi | 21 + third-party-stubs/mashumaro/mixins/yaml.pyi | 21 +- third-party-stubs/mashumaro/types.pyi | 22 +- 64 files changed, 4115 insertions(+), 3683 deletions(-) create mode 100644 .changes/unreleased/Under the Hood-20230718-145428.yaml delete mode 100644 third-party-stubs/mashumaro/core/meta/builder.pyi rename third-party-stubs/mashumaro/{dialects => core/meta/code}/__init__.pyi (100%) create mode 100644 third-party-stubs/mashumaro/core/meta/code/builder.pyi create mode 100644 third-party-stubs/mashumaro/core/meta/code/lines.pyi create mode 100644 third-party-stubs/mashumaro/core/meta/mixin.pyi delete mode 100644 third-party-stubs/mashumaro/core/meta/patch.pyi create mode 100644 third-party-stubs/mashumaro/core/meta/types/__init__.pyi create mode 100644 third-party-stubs/mashumaro/core/meta/types/common.pyi create mode 100644 third-party-stubs/mashumaro/core/meta/types/pack.pyi create mode 100644 third-party-stubs/mashumaro/core/meta/types/unpack.pyi delete mode 100644 third-party-stubs/mashumaro/dialects/msgpack.pyi create mode 100644 third-party-stubs/mashumaro/jsonschema/__init__.pyi create mode 100644 third-party-stubs/mashumaro/jsonschema/annotations.pyi create mode 100644 third-party-stubs/mashumaro/jsonschema/builder.pyi create mode 100644 third-party-stubs/mashumaro/jsonschema/dialects.pyi create mode 100644 third-party-stubs/mashumaro/jsonschema/models.pyi create mode 100644 third-party-stubs/mashumaro/jsonschema/schema.pyi create mode 100644 third-party-stubs/mashumaro/mixins/orjson.pyi create mode 100644 third-party-stubs/mashumaro/mixins/toml.pyi diff --git a/.changes/unreleased/Under the Hood-20230718-145428.yaml b/.changes/unreleased/Under the Hood-20230718-145428.yaml new file mode 100644 index 00000000000..24ffb706cf2 --- /dev/null +++ b/.changes/unreleased/Under the Hood-20230718-145428.yaml @@ -0,0 +1,6 @@ +kind: Under the Hood +body: Switch from hologram to mashumaro jsonschema +time: 2023-07-18T14:54:28.41453-04:00 +custom: + Author: gshank + Issue: "8426" diff --git a/core/dbt/context/context_config.py b/core/dbt/context/context_config.py index 437b47eb4b3..3cdde7f3b00 100644 --- a/core/dbt/context/context_config.py +++ b/core/dbt/context/context_config.py @@ -189,9 +189,21 @@ def initial_result(self, resource_type: NodeType, base: bool) -> C: def _update_from_config(self, result: C, partial: Dict[str, Any], validate: bool = False) -> C: translated = self._active_project.credentials.translate_aliases(partial) - return result.update_from( + translated = self.translate_hook_names(translated) + updated = result.update_from( translated, self._active_project.credentials.type, validate=validate ) + return updated + + def translate_hook_names(self, project_dict): + # This is a kind of kludge because the fix for #6411 specifically allowed misspelling + # the hook field names in dbt_project.yml, which only ever worked because we didn't + # run validate on the dbt_project configs. + if "pre_hook" in project_dict: + project_dict["pre-hook"] = project_dict.pop("pre_hook") + if "post_hook" in project_dict: + project_dict["post-hook"] = project_dict.pop("post_hook") + return project_dict def calculate_node_config_dict( self, diff --git a/core/dbt/contracts/connection.py b/core/dbt/contracts/connection.py index 41eb0bccb8d..9f2447f1fce 100644 --- a/core/dbt/contracts/connection.py +++ b/core/dbt/contracts/connection.py @@ -16,26 +16,21 @@ from dbt.events.functions import fire_event from dbt.events.types import NewConnectionOpening from dbt.events.contextvars import get_node_info -from typing_extensions import Protocol +from typing_extensions import Protocol, Annotated from dbt.dataclass_schema import ( dbtClassMixin, StrEnum, ExtensibleDbtClassMixin, - HyphenatedDbtClassMixin, ValidatedStringMixin, - register_pattern, ) from dbt.contracts.util import Replaceable +from mashumaro.jsonschema.annotations import Pattern class Identifier(ValidatedStringMixin): ValidationRegex = r"^[A-Za-z_][A-Za-z0-9_]+$" -# we need register_pattern for jsonschema validation -register_pattern(Identifier, r"^[A-Za-z_][A-Za-z0-9_]+$") - - @dataclass class AdapterResponse(dbtClassMixin): _message: str @@ -55,7 +50,8 @@ class ConnectionState(StrEnum): @dataclass(init=False) class Connection(ExtensibleDbtClassMixin, Replaceable): - type: Identifier + # Annotated is used by mashumaro for jsonschema generation + type: Annotated[Identifier, Pattern(r"^[A-Za-z_][A-Za-z0-9_]+$")] name: Optional[str] = None state: ConnectionState = ConnectionState.INIT transaction_open: bool = False @@ -161,6 +157,7 @@ def _connection_keys(self) -> Tuple[str, ...]: @classmethod def __pre_deserialize__(cls, data): data = super().__pre_deserialize__(data) + # Need to fixup dbname => database, pass => password data = cls.translate_aliases(data) return data @@ -220,10 +217,10 @@ def to_target_dict(self): @dataclass -class QueryComment(HyphenatedDbtClassMixin): +class QueryComment(dbtClassMixin): comment: str = DEFAULT_QUERY_COMMENT append: bool = False - job_label: bool = False + job_label: bool = field(default=False, metadata={"alias": "job-label"}) class AdapterRequiredConfig(HasCredentials, Protocol): diff --git a/core/dbt/contracts/graph/model_config.py b/core/dbt/contracts/graph/model_config.py index c4faeb861f9..abf4951714a 100644 --- a/core/dbt/contracts/graph/model_config.py +++ b/core/dbt/contracts/graph/model_config.py @@ -2,11 +2,11 @@ from enum import Enum from itertools import chain from typing import Any, List, Optional, Dict, Union, Type, TypeVar, Callable +from typing_extensions import Annotated from dbt.dataclass_schema import ( dbtClassMixin, ValidationError, - register_pattern, StrEnum, ) from dbt.contracts.graph.unparsed import AdditionalPropertiesAllowed, Docs @@ -15,6 +15,7 @@ from dbt.exceptions import DbtInternalError, CompilationError from dbt import hooks from dbt.node_types import NodeType +from mashumaro.jsonschema.annotations import Pattern M = TypeVar("M", bound="Metadata") @@ -188,9 +189,6 @@ class Severity(str): pass -register_pattern(Severity, insensitive_patterns("warn", "error")) - - class OnConfigurationChangeOption(StrEnum): Apply = "apply" Continue = "continue" @@ -376,15 +374,6 @@ def finalize_and_validate(self: T) -> T: self.validate(dct) return self.from_dict(dct) - def replace(self, **kwargs): - dct = self.to_dict(omit_none=True) - - mapping = self.field_mapping() - for key, value in kwargs.items(): - new_key = mapping.get(key, key) - dct[new_key] = value - return self.from_dict(dct) - @dataclass class SemanticModelConfig(BaseConfig): @@ -447,11 +436,11 @@ class NodeConfig(NodeAndTestConfig): persist_docs: Dict[str, Any] = field(default_factory=dict) post_hook: List[Hook] = field( default_factory=list, - metadata=MergeBehavior.Append.meta(), + metadata={"merge": MergeBehavior.Append, "alias": "post-hook"}, ) pre_hook: List[Hook] = field( default_factory=list, - metadata=MergeBehavior.Append.meta(), + metadata={"merge": MergeBehavior.Append, "alias": "pre-hook"}, ) quoting: Dict[str, Any] = field( default_factory=dict, @@ -511,30 +500,11 @@ def __post_init__(self): @classmethod def __pre_deserialize__(cls, data): data = super().__pre_deserialize__(data) - field_map = {"post-hook": "post_hook", "pre-hook": "pre_hook"} - # create a new dict because otherwise it gets overwritten in - # tests - new_dict = {} - for key in data: - new_dict[key] = data[key] - data = new_dict for key in hooks.ModelHookType: if key in data: data[key] = [hooks.get_hook_dict(h) for h in data[key]] - for field_name in field_map: - if field_name in data: - new_name = field_map[field_name] - data[new_name] = data.pop(field_name) return data - def __post_serialize__(self, dct): - dct = super().__post_serialize__(dct) - field_map = {"post_hook": "post-hook", "pre_hook": "pre-hook"} - for field_name in field_map: - if field_name in dct: - dct[field_map[field_name]] = dct.pop(field_name) - return dct - # this is still used by jsonschema validation @classmethod def field_mapping(cls): @@ -554,6 +524,9 @@ def validate(cls, data): raise ValidationError("A seed must have a materialized value of 'seed'") +SEVERITY_PATTERN = r"^([Ww][Aa][Rr][Nn]|[Ee][Rr][Rr][Oo][Rr])$" + + @dataclass class TestConfig(NodeAndTestConfig): __test__ = False @@ -564,7 +537,8 @@ class TestConfig(NodeAndTestConfig): metadata=CompareBehavior.Exclude.meta(), ) materialized: str = "test" - severity: Severity = Severity("ERROR") + # Annotated is used by mashumaro for jsonschema generation + severity: Annotated[Severity, Pattern(SEVERITY_PATTERN)] = Severity("ERROR") store_failures: Optional[bool] = None where: Optional[str] = None limit: Optional[int] = None diff --git a/core/dbt/contracts/graph/nodes.py b/core/dbt/contracts/graph/nodes.py index 399b658ff87..b25be7c09b8 100644 --- a/core/dbt/contracts/graph/nodes.py +++ b/core/dbt/contracts/graph/nodes.py @@ -6,7 +6,7 @@ import hashlib from mashumaro.types import SerializableType -from typing import Optional, Union, List, Dict, Any, Sequence, Tuple, Iterator +from typing import Optional, Union, List, Dict, Any, Sequence, Tuple, Iterator, Literal from dbt.dataclass_schema import dbtClassMixin, ExtensibleDbtClassMixin @@ -556,18 +556,18 @@ def depends_on_macros(self): @dataclass class AnalysisNode(CompiledNode): - resource_type: NodeType = field(metadata={"restrict": [NodeType.Analysis]}) + resource_type: Literal[NodeType.Analysis] @dataclass class HookNode(CompiledNode): - resource_type: NodeType = field(metadata={"restrict": [NodeType.Operation]}) + resource_type: Literal[NodeType.Operation] index: Optional[int] = None @dataclass class ModelNode(CompiledNode): - resource_type: NodeType = field(metadata={"restrict": [NodeType.Model]}) + resource_type: Literal[NodeType.Model] access: AccessType = AccessType.Protected constraints: List[ModelLevelConstraint] = field(default_factory=list) version: Optional[NodeVersion] = None @@ -854,12 +854,12 @@ def same_contract(self, old, adapter_type=None) -> bool: # TODO: rm? @dataclass class RPCNode(CompiledNode): - resource_type: NodeType = field(metadata={"restrict": [NodeType.RPCCall]}) + resource_type: Literal[NodeType.RPCCall] @dataclass class SqlNode(CompiledNode): - resource_type: NodeType = field(metadata={"restrict": [NodeType.SqlOperation]}) + resource_type: Literal[NodeType.SqlOperation] # ==================================== @@ -869,7 +869,7 @@ class SqlNode(CompiledNode): @dataclass class SeedNode(ParsedNode): # No SQLDefaults! - resource_type: NodeType = field(metadata={"restrict": [NodeType.Seed]}) + resource_type: Literal[NodeType.Seed] config: SeedConfig = field(default_factory=SeedConfig) # seeds need the root_path because the contents are not loaded initially # and we need the root_path to load the seed later @@ -995,7 +995,7 @@ def is_relational(self): @dataclass class SingularTestNode(TestShouldStoreFailures, CompiledNode): - resource_type: NodeType = field(metadata={"restrict": [NodeType.Test]}) + resource_type: Literal[NodeType.Test] # Was not able to make mypy happy and keep the code working. We need to # refactor the various configs. config: TestConfig = field(default_factory=TestConfig) # type: ignore @@ -1031,7 +1031,7 @@ class HasTestMetadata(dbtClassMixin): @dataclass class GenericTestNode(TestShouldStoreFailures, CompiledNode, HasTestMetadata): - resource_type: NodeType = field(metadata={"restrict": [NodeType.Test]}) + resource_type: Literal[NodeType.Test] column_name: Optional[str] = None file_key_name: Optional[str] = None # Was not able to make mypy happy and keep the code working. We need to @@ -1064,13 +1064,13 @@ class IntermediateSnapshotNode(CompiledNode): # uses a regular node config, which the snapshot parser will then convert # into a full ParsedSnapshotNode after rendering. Note: it currently does # not work to set snapshot config in schema files because of the validation. - resource_type: NodeType = field(metadata={"restrict": [NodeType.Snapshot]}) + resource_type: Literal[NodeType.Snapshot] config: EmptySnapshotConfig = field(default_factory=EmptySnapshotConfig) @dataclass class SnapshotNode(CompiledNode): - resource_type: NodeType = field(metadata={"restrict": [NodeType.Snapshot]}) + resource_type: Literal[NodeType.Snapshot] config: SnapshotConfig defer_relation: Optional[DeferRelation] = None @@ -1083,7 +1083,7 @@ class SnapshotNode(CompiledNode): @dataclass class Macro(BaseNode): macro_sql: str - resource_type: NodeType = field(metadata={"restrict": [NodeType.Macro]}) + resource_type: Literal[NodeType.Macro] depends_on: MacroDependsOn = field(default_factory=MacroDependsOn) description: str = "" meta: Dict[str, Any] = field(default_factory=dict) @@ -1113,7 +1113,7 @@ def depends_on_macros(self): @dataclass class Documentation(BaseNode): block_contents: str - resource_type: NodeType = field(metadata={"restrict": [NodeType.Documentation]}) + resource_type: Literal[NodeType.Documentation] @property def search_name(self): @@ -1144,7 +1144,7 @@ class UnpatchedSourceDefinition(BaseNode): source: UnparsedSourceDefinition table: UnparsedSourceTableDefinition fqn: List[str] - resource_type: NodeType = field(metadata={"restrict": [NodeType.Source]}) + resource_type: Literal[NodeType.Source] patch_path: Optional[str] = None def get_full_source_name(self): @@ -1189,7 +1189,7 @@ class ParsedSourceMandatory(GraphNode, HasRelationMetadata): source_description: str loader: str identifier: str - resource_type: NodeType = field(metadata={"restrict": [NodeType.Source]}) + resource_type: Literal[NodeType.Source] @dataclass @@ -1316,7 +1316,7 @@ def search_name(self): class Exposure(GraphNode): type: ExposureType owner: Owner - resource_type: NodeType = field(metadata={"restrict": [NodeType.Exposure]}) + resource_type: Literal[NodeType.Exposure] description: str = "" label: Optional[str] = None maturity: Optional[MaturityType] = None @@ -1465,7 +1465,7 @@ class Metric(GraphNode): type_params: MetricTypeParams filter: Optional[WhereFilter] = None metadata: Optional[SourceFileMetadata] = None - resource_type: NodeType = field(metadata={"restrict": [NodeType.Metric]}) + resource_type: Literal[NodeType.Metric] meta: Dict[str, Any] = field(default_factory=dict) tags: List[str] = field(default_factory=list) config: MetricConfig = field(default_factory=MetricConfig) @@ -1548,7 +1548,7 @@ def same_contents(self, old: Optional["Metric"]) -> bool: class Group(BaseNode): name: str owner: Owner - resource_type: NodeType = field(metadata={"restrict": [NodeType.Group]}) + resource_type: Literal[NodeType.Group] # ==================================== diff --git a/core/dbt/contracts/graph/unparsed.py b/core/dbt/contracts/graph/unparsed.py index 2b355f42abd..59eeaadf8fb 100644 --- a/core/dbt/contracts/graph/unparsed.py +++ b/core/dbt/contracts/graph/unparsed.py @@ -23,7 +23,7 @@ from dataclasses import dataclass, field from datetime import timedelta from pathlib import Path -from typing import Optional, List, Union, Dict, Any, Sequence +from typing import Optional, List, Union, Dict, Any, Sequence, Literal @dataclass @@ -49,31 +49,18 @@ def empty(self): @dataclass class UnparsedMacro(UnparsedBaseNode, HasCode): - resource_type: NodeType = field(metadata={"restrict": [NodeType.Macro]}) + resource_type: Literal[NodeType.Macro] @dataclass class UnparsedGenericTest(UnparsedBaseNode, HasCode): - resource_type: NodeType = field(metadata={"restrict": [NodeType.Macro]}) + resource_type: Literal[NodeType.Macro] @dataclass class UnparsedNode(UnparsedBaseNode, HasCode): name: str - resource_type: NodeType = field( - metadata={ - "restrict": [ - NodeType.Model, - NodeType.Analysis, - NodeType.Test, - NodeType.Snapshot, - NodeType.Operation, - NodeType.Seed, - NodeType.RPCCall, - NodeType.SqlOperation, - ] - } - ) + resource_type: NodeType @property def search_name(self): @@ -82,7 +69,7 @@ def search_name(self): @dataclass class UnparsedRunHook(UnparsedNode): - resource_type: NodeType = field(metadata={"restrict": [NodeType.Operation]}) + resource_type: Literal[NodeType.Operation] index: Optional[int] = None diff --git a/core/dbt/contracts/project.py b/core/dbt/contracts/project.py index d9bd0c6fb89..137c00d4f51 100644 --- a/core/dbt/contracts/project.py +++ b/core/dbt/contracts/project.py @@ -4,13 +4,14 @@ from dbt.dataclass_schema import ( dbtClassMixin, ValidationError, - HyphenatedDbtClassMixin, ExtensibleDbtClassMixin, - register_pattern, + dbtMashConfig, ) from dataclasses import dataclass, field -from typing import Optional, List, Dict, Union, Any +from typing import Optional, List, Dict, Union, Any, ClassVar +from typing_extensions import Annotated from mashumaro.types import SerializableType +from mashumaro.jsonschema.annotations import Pattern DEFAULT_SEND_ANONYMOUS_USAGE_STATS = True @@ -25,12 +26,8 @@ def _deserialize(cls, value: str) -> "SemverString": return SemverString(value) -# this supports full semver, -# but also allows for 2 group version numbers, (allows '1.0'). -register_pattern( - SemverString, - r"^(0|[1-9]\d*)\.(0|[1-9]\d*)(\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)?$", # noqa -) +# This supports full semver, but also allows for 2 group version numbers, (allows '1.0'). +sem_ver_pattern = r"^(0|[1-9]\d*)\.(0|[1-9]\d*)(\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)?$" @dataclass @@ -42,7 +39,7 @@ class Quoting(dbtClassMixin, Mergeable): @dataclass -class Package(Replaceable, HyphenatedDbtClassMixin): +class Package(dbtClassMixin, Replaceable): pass @@ -65,7 +62,7 @@ class TarballPackage(Package): class GitPackage(Package): git: str revision: Optional[RawVersion] = None - warn_unpinned: Optional[bool] = None + warn_unpinned: Optional[bool] = field(default=None, metadata={"alias": "warn-unpinned"}) subdirectory: Optional[str] = None def get_revisions(self) -> List[str]: @@ -182,10 +179,13 @@ class RegistryPackageMetadata( @dataclass -class Project(HyphenatedDbtClassMixin, Replaceable): - name: Identifier +class Project(dbtClassMixin, Replaceable): + _hyphenated: ClassVar[bool] = True + # Annotated is used by mashumaro for jsonschema generation + name: Annotated[Identifier, Pattern(r"^[^\d\W]\w*$")] config_version: Optional[int] = 2 - version: Optional[Union[SemverString, float]] = None + # Annotated is used by mashumaro for jsonschema generation + version: Optional[Union[Annotated[SemverString, Pattern(sem_ver_pattern)], float]] = None project_root: Optional[str] = None source_paths: Optional[List[str]] = None model_paths: Optional[List[str]] = None @@ -225,6 +225,32 @@ class Project(HyphenatedDbtClassMixin, Replaceable): query_comment: Optional[Union[QueryComment, NoValue, str]] = field(default_factory=NoValue) restrict_access: bool = False + class Config(dbtMashConfig): + # These tell mashumaro to use aliases for jsonschema and for "from_dict" + aliases = { + "config_version": "config-version", + "project_root": "project-root", + "source_paths": "source-paths", + "model_paths": "model-paths", + "macro_paths": "macro-paths", + "data_paths": "data-paths", + "seed_paths": "seed-paths", + "test_paths": "test-paths", + "analysis_paths": "analysis-paths", + "docs_paths": "docs-paths", + "asset_paths": "asset-paths", + "target_path": "target-path", + "snapshot_paths": "snapshot-paths", + "clean_targets": "clean-targets", + "log_path": "log-path", + "packages_install_path": "packages-install-path", + "on_run_start": "on-run-start", + "on_run_end": "on-run-end", + "require_dbt_version": "require-dbt-version", + "query_comment": "query-comment", + "restrict_access": "restrict-access", + } + @classmethod def validate(cls, data): super().validate(data) @@ -267,10 +293,10 @@ class UserConfig(ExtensibleDbtClassMixin, Replaceable, UserConfigContract): @dataclass -class ProfileConfig(HyphenatedDbtClassMixin, Replaceable): - profile_name: str = field(metadata={"preserve_underscore": True}) - target_name: str = field(metadata={"preserve_underscore": True}) - user_config: UserConfig = field(metadata={"preserve_underscore": True}) +class ProfileConfig(dbtClassMixin, Replaceable): + profile_name: str + target_name: str + user_config: UserConfig threads: int # TODO: make this a dynamic union of some kind? credentials: Optional[Dict[str, Any]] diff --git a/core/dbt/contracts/util.py b/core/dbt/contracts/util.py index 45c712715b5..e632203c0b1 100644 --- a/core/dbt/contracts/util.py +++ b/core/dbt/contracts/util.py @@ -16,8 +16,9 @@ from dbt.dataclass_schema import ( ValidatedStringMixin, ValidationError, - register_pattern, ) +from mashumaro.jsonschema import build_json_schema +import functools SourceKey = Tuple[str, str] @@ -90,7 +91,9 @@ def __pre_deserialize__(cls, data): cls_keys = cls._get_field_names() new_dict = {} for key, value in data.items(): - if key not in cls_keys and key != "_extra": + # The pre-hook/post-hook mess hasn't been converted yet... That happens in + # the super().__pre_deserialize__ below... + if key not in cls_keys and key not in ["_extra", "pre-hook", "post-hook"]: if "_extra" not in new_dict: new_dict["_extra"] = {} new_dict["_extra"][key] = value @@ -192,11 +195,12 @@ class VersionedSchema(dbtClassMixin): dbt_schema_version: ClassVar[SchemaVersion] @classmethod - def json_schema(cls, embeddable: bool = False) -> Dict[str, Any]: - result = super().json_schema(embeddable=embeddable) - if not embeddable: - result["$id"] = str(cls.dbt_schema_version) - return result + @functools.lru_cache + def json_schema(cls) -> Dict[str, Any]: + json_schema_obj = build_json_schema(cls, all_refs=True) + json_schema = json_schema_obj.to_dict() + json_schema["$id"] = str(cls.dbt_schema_version) + return json_schema @classmethod def is_compatible_version(cls, schema_version): @@ -278,6 +282,3 @@ def is_valid(cls, value: Any) -> bool: return False return True - - -register_pattern(Identifier, r"^[^\d\W]\w*$") diff --git a/core/dbt/dataclass_schema.py b/core/dbt/dataclass_schema.py index 82a60ecdf64..d718604b5bf 100644 --- a/core/dbt/dataclass_schema.py +++ b/core/dbt/dataclass_schema.py @@ -1,97 +1,123 @@ -from typing import ( - Type, - ClassVar, - cast, -) +from typing import ClassVar, cast, get_type_hints, List, Tuple, Dict, Any, Optional import re -from dataclasses import fields +import jsonschema +from dataclasses import fields, Field from enum import Enum from datetime import datetime from dateutil.parser import parse -from hologram import JsonSchemaMixin, FieldEncoder, ValidationError - # type: ignore from mashumaro import DataClassDictMixin from mashumaro.config import TO_DICT_ADD_OMIT_NONE_FLAG, BaseConfig as MashBaseConfig from mashumaro.types import SerializableType, SerializationStrategy +from mashumaro.jsonschema import build_json_schema + +import functools + + +class ValidationError(jsonschema.ValidationError): + pass class DateTimeSerialization(SerializationStrategy): - def serialize(self, value): + def serialize(self, value) -> str: out = value.isoformat() # Assume UTC if timezone is missing if value.tzinfo is None: out += "Z" return out - def deserialize(self, value): + def deserialize(self, value) -> datetime: return value if isinstance(value, datetime) else parse(cast(str, value)) -# This class pulls in both JsonSchemaMixin from Hologram and -# DataClassDictMixin from our fork of Mashumaro. The 'to_dict' -# and 'from_dict' methods come from Mashumaro. Building -# jsonschemas for every class and the 'validate' method -# come from Hologram. -class dbtClassMixin(DataClassDictMixin, JsonSchemaMixin): +class dbtMashConfig(MashBaseConfig): + code_generation_options = [ + TO_DICT_ADD_OMIT_NONE_FLAG, + ] + serialization_strategy = { + datetime: DateTimeSerialization(), + } + json_schema = { + "additionalProperties": False, + } + serialize_by_alias = True + + +# This class pulls in DataClassDictMixin from Mashumaro. The 'to_dict' +# and 'from_dict' methods come from Mashumaro. +class dbtClassMixin(DataClassDictMixin): """The Mixin adds methods to generate a JSON schema and convert to and from JSON encodable dicts with validation against the schema """ - class Config(MashBaseConfig): - code_generation_options = [ - TO_DICT_ADD_OMIT_NONE_FLAG, - ] - serialization_strategy = { - datetime: DateTimeSerialization(), - } + _mapped_fields: ClassVar[Optional[Dict[Any, List[Tuple[Field, str]]]]] = None + + # Config class used by Mashumaro + class Config(dbtMashConfig): + pass - _hyphenated: ClassVar[bool] = False ADDITIONAL_PROPERTIES: ClassVar[bool] = False - # This is called by the mashumaro to_dict in order to handle - # nested classes. - # Munges the dict that's returned. - def __post_serialize__(self, dct): - if self._hyphenated: - new_dict = {} - for key in dct: - if "_" in key: - new_key = key.replace("_", "-") - new_dict[new_key] = dct[key] - else: - new_dict[key] = dct[key] - dct = new_dict - - return dct - - # This is called by the mashumaro _from_dict method, before - # performing the conversion to a dict + # This is called by the mashumaro from_dict in order to handle + # nested classes. We no longer do any munging here, but leaving here + # so that subclasses can leave super() in place for possible future needs. @classmethod def __pre_deserialize__(cls, data): - # `data` might not be a dict, e.g. for `query_comment`, which accepts - # a dict or a string; only snake-case for dict values. - if cls._hyphenated and isinstance(data, dict): - new_dict = {} - for key in data: - if "-" in key: - new_key = key.replace("-", "_") - new_dict[new_key] = data[key] - else: - new_dict[key] = data[key] - data = new_dict return data - # This is used in the hologram._encode_field method, which calls - # a 'to_dict' method which does not have the same parameters in - # hologram and in mashumaro. - def _local_to_dict(self, **kwargs): - args = {} - if "omit_none" in kwargs: - args["omit_none"] = kwargs["omit_none"] - return self.to_dict(**args) + # This is called by the mashumaro to_dict in order to handle + # nested classes. We no longer do any munging here, but leaving here + # so that subclasses can leave super() in place for possible future needs. + def __post_serialize__(self, data): + return data + + @classmethod + @functools.lru_cache + def json_schema(cls): + json_schema_obj = build_json_schema(cls) + json_schema = json_schema_obj.to_dict() + return json_schema + + @classmethod + def validate(cls, data): + json_schema = cls.json_schema() + validator = jsonschema.Draft7Validator(json_schema) + error = next(iter(validator.iter_errors(data)), None) + if error is not None: + raise ValidationError.create_from(error) from error + + # This method was copied from hologram. Used in model_config.py and relation.py + @classmethod + def _get_fields(cls) -> List[Tuple[Field, str]]: + if cls._mapped_fields is None: + cls._mapped_fields = {} + if cls.__name__ not in cls._mapped_fields: + mapped_fields = [] + type_hints = get_type_hints(cls) + + for f in fields(cls): # type: ignore + # Skip internal fields + if f.name.startswith("_"): + continue + + # Note fields() doesn't resolve forward refs + f.type = type_hints[f.name] + + # hologram used the "field_mapping" here, but we use the + # the field's metadata "alias". Since this method is mainly + # just used in merging config dicts, it mostly applies to + # pre-hook and post-hook. + field_name = f.metadata.get("alias", f.name) + mapped_fields.append((f, field_name)) + cls._mapped_fields[cls.__name__] = mapped_fields + return cls._mapped_fields[cls.__name__] + + # copied from hologram. Used in tests + @classmethod + def _get_field_names(cls): + return [element[1] for element in cls._get_fields()] class ValidatedStringMixin(str, SerializableType): @@ -130,38 +156,10 @@ def _deserialize(cls, value: str): return cls(value) -class HyphenatedDbtClassMixin(dbtClassMixin): - # used by from_dict/to_dict - _hyphenated: ClassVar[bool] = True - - # used by jsonschema validation, _get_fields - @classmethod - def field_mapping(cls): - result = {} - for field in fields(cls): - skip = field.metadata.get("preserve_underscore") - if skip: - continue - - if "_" in field.name: - result[field.name] = field.name.replace("_", "-") - return result - - class ExtensibleDbtClassMixin(dbtClassMixin): ADDITIONAL_PROPERTIES = True - -# This is used by Hologram in jsonschema validation -def register_pattern(base_type: Type, pattern: str) -> None: - """base_type should be a typing.NewType that should always have the given - regex pattern. That means that its underlying type ('__supertype__') had - better be a str! - """ - - class PatternEncoder(FieldEncoder): - @property - def json_schema(self): - return {"type": "string", "pattern": pattern} - - dbtClassMixin.register_field_encoders({base_type: PatternEncoder()}) + class Config(dbtMashConfig): + json_schema = { + "additionalProperties": True, + } diff --git a/core/dbt/helper_types.py b/core/dbt/helper_types.py index 77e25c68ce8..545d44a9087 100644 --- a/core/dbt/helper_types.py +++ b/core/dbt/helper_types.py @@ -4,12 +4,8 @@ from __future__ import annotations from dataclasses import dataclass, field -from datetime import timedelta -from pathlib import Path from typing import Tuple, AbstractSet, Union -from hologram import FieldEncoder, JsonDict -from mashumaro.types import SerializableType -from typing import Callable, cast, Generic, Optional, TypeVar, List +from typing import Callable, cast, Generic, Optional, TypeVar, List, NewType from dbt.dataclass_schema import ( dbtClassMixin, @@ -19,60 +15,7 @@ import dbt.events.types as dbt_event_types -class Port(int, SerializableType): - @classmethod - def _deserialize(cls, value: Union[int, str]) -> "Port": - try: - value = int(value) - except ValueError: - raise ValidationError(f"Cannot encode {value} into port number") - - return Port(value) - - def _serialize(self) -> int: - return self - - -class PortEncoder(FieldEncoder): - @property - def json_schema(self): - return {"type": "integer", "minimum": 0, "maximum": 65535} - - -class TimeDeltaFieldEncoder(FieldEncoder[timedelta]): - """Encodes timedeltas to dictionaries""" - - def to_wire(self, value: timedelta) -> float: - return value.total_seconds() - - def to_python(self, value) -> timedelta: - if isinstance(value, timedelta): - return value - try: - return timedelta(seconds=value) - except TypeError: - raise ValidationError("cannot encode {} into timedelta".format(value)) from None - - @property - def json_schema(self) -> JsonDict: - return {"type": "number"} - - -class PathEncoder(FieldEncoder): - def to_wire(self, value: Path) -> str: - return str(value) - - def to_python(self, value) -> Path: - if isinstance(value, Path): - return value - try: - return Path(value) - except TypeError: - raise ValidationError("cannot encode {} into timedelta".format(value)) from None - - @property - def json_schema(self) -> JsonDict: - return {"type": "string"} +Port = NewType("Port", int) class NVEnum(StrEnum): @@ -132,15 +75,6 @@ def _validate_items(self, items: List[str]): raise ValidationError(f"{item} is not a valid dbt error name.") -dbtClassMixin.register_field_encoders( - { - Port: PortEncoder(), - timedelta: TimeDeltaFieldEncoder(), - Path: PathEncoder(), - } -) - - FQNPath = Tuple[str, ...] PathSet = AbstractSet[FQNPath] diff --git a/core/dbt/parser/base.py b/core/dbt/parser/base.py index b24cd4712d4..17672de1b24 100644 --- a/core/dbt/parser/base.py +++ b/core/dbt/parser/base.py @@ -236,6 +236,7 @@ def _create_parsetime_node( "checksum": block.file.checksum.to_dict(omit_none=True), } dct.update(kwargs) + try: return self.parse_from_dict(dct, validate=True) except ValidationError as exc: diff --git a/core/dbt/utils.py b/core/dbt/utils.py index 72fc4fcfdc6..6ebd55774ce 100644 --- a/core/dbt/utils.py +++ b/core/dbt/utils.py @@ -416,6 +416,7 @@ def translate_aliases( # Note that this only affects hologram json validation. # It has no effect on mashumaro serialization. +# Q: Can this be removed? def restrict_to(*restrictions): """Create the metadata for a restricted dataclass field""" return {"restrict": list(restrictions)} diff --git a/core/setup.py b/core/setup.py index 82908bf6096..58962490179 100644 --- a/core/setup.py +++ b/core/setup.py @@ -51,7 +51,7 @@ # Pin to the patch or minor version, and bump in each new minor version of dbt-core. "agate~=1.7.0", "Jinja2~=3.1.2", - "mashumaro[msgpack]~=3.8.1", + "mashumaro[msgpack]~=3.9", # ---- # Legacy: This package has not been updated since 2019, and it is unused in dbt's logging system (since v1.0) # The dependency here will be removed along with the removal of 'legacy logging', in a future release of dbt-core @@ -72,12 +72,12 @@ # ---- # These are major-version-0 packages also maintained by dbt-labs. Accept patches. "dbt-extractor~=0.5.0", - "hologram~=0.0.16", # includes transitive dependencies on python-dateutil and jsonschema "minimal-snowplow-tracker~=0.0.2", # DSI is under active development, so we're pinning to specific dev versions for now. "dbt-semantic-interfaces~=0.2.0", # ---- # Expect compatibility with all new versions of these packages, so lower bounds only. + "jsonschema>=3.0", "packaging>20.9", "protobuf>=4.0.0", "pytz>=2015.7", diff --git a/dev-requirements.txt b/dev-requirements.txt index 1b290c05b61..c444fc7d975 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -26,6 +26,7 @@ types-docutils types-PyYAML types-freezegun types-Jinja2 +types-jsonschema types-mock types-protobuf types-python-dateutil diff --git a/plugins/postgres/dbt/adapters/postgres/connections.py b/plugins/postgres/dbt/adapters/postgres/connections.py index 2a1b4e13420..ac7df536bdb 100644 --- a/plugins/postgres/dbt/adapters/postgres/connections.py +++ b/plugins/postgres/dbt/adapters/postgres/connections.py @@ -12,6 +12,8 @@ from dbt.helper_types import Port from dataclasses import dataclass from typing import Optional +from typing_extensions import Annotated +from mashumaro.jsonschema.annotations import Maximum, Minimum logger = AdapterLogger("Postgres") @@ -21,7 +23,8 @@ class PostgresCredentials(Credentials): host: str user: str - port: Port + # Annotated is used by mashumaro for jsonschema generation + port: Annotated[Port, Minimum(0), Maximum(65535)] password: str # on postgres the password is mandatory connect_timeout: int = 10 role: Optional[str] = None diff --git a/schemas/dbt/catalog/v1.json b/schemas/dbt/catalog/v1.json index 08f76a591bf..0493014e5e7 100644 --- a/schemas/dbt/catalog/v1.json +++ b/schemas/dbt/catalog/v1.json @@ -1,126 +1,45 @@ { - "type": "object", - "required": [ - "metadata", - "nodes", - "sources" - ], - "properties": { - "metadata": { - "$ref": "#/definitions/CatalogMetadata" - }, - "nodes": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/CatalogTable" - } - }, - "sources": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/CatalogTable" - } - }, - "errors": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "string" - } - }, - { - "type": "null" - } - ] - } - }, - "additionalProperties": false, - "description": "CatalogArtifact(metadata: dbt.contracts.results.CatalogMetadata, nodes: Dict[str, dbt.contracts.results.CatalogTable], sources: Dict[str, dbt.contracts.results.CatalogTable], errors: Optional[List[str]] = None, _compile_results: Optional[Any] = None)", - "definitions": { + "$ref": "#/$defs/CatalogArtifact", + "$defs": { "CatalogMetadata": { "type": "object", - "required": [], + "title": "CatalogMetadata", "properties": { "dbt_schema_version": { - "type": "string", - "default": "https://schemas.getdbt.com/dbt/catalog/v1.json" + "type": "string" }, "dbt_version": { "type": "string", - "default": "1.5.0a1" + "default": "1.7.0b1" }, "generated_at": { - "type": "string", - "format": "date-time", - "default": "2023-02-09T23:46:55.265093Z" + "type": "string" }, "invocation_id": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ], - "default": "e6a9b266-203d-4fec-93af-fb8f55423a6b" + ] }, "env": { "type": "object", "additionalProperties": { "type": "string" }, - "default": {} - } - }, - "additionalProperties": false, - "description": "CatalogMetadata(dbt_schema_version: str = , dbt_version: str = '1.5.0a1', generated_at: datetime.datetime = , invocation_id: Optional[str] = , env: Dict[str, str] = )" - }, - "CatalogTable": { - "type": "object", - "required": [ - "metadata", - "columns", - "stats" - ], - "properties": { - "metadata": { - "$ref": "#/definitions/TableMetadata" - }, - "columns": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/ColumnMetadata" - } - }, - "stats": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/StatsItem" + "propertyNames": { + "type": "string" } - }, - "unique_id": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] } }, - "additionalProperties": false, - "description": "CatalogTable(metadata: dbt.contracts.results.TableMetadata, columns: Dict[str, dbt.contracts.results.ColumnMetadata], stats: Dict[str, dbt.contracts.results.StatsItem], unique_id: Optional[str] = None)" + "additionalProperties": false }, "TableMetadata": { "type": "object", - "required": [ - "type", - "schema", - "name" - ], + "title": "TableMetadata", "properties": { "type": { "type": "string" @@ -132,46 +51,49 @@ "type": "string" }, "database": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "comment": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "owner": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null } }, "additionalProperties": false, - "description": "TableMetadata(type: str, schema: str, name: str, database: Optional[str] = None, comment: Optional[str] = None, owner: Optional[str] = None)" - }, - "ColumnMetadata": { - "type": "object", "required": [ "type", - "index", + "schema", "name" - ], + ] + }, + "ColumnMetadata": { + "type": "object", + "title": "ColumnMetadata", "properties": { "type": { "type": "string" @@ -183,26 +105,27 @@ "type": "string" }, "comment": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null } }, "additionalProperties": false, - "description": "ColumnMetadata(type: str, index: int, name: str, comment: Optional[str] = None)" + "required": [ + "type", + "index", + "name" + ] }, "StatsItem": { "type": "object", - "required": [ - "id", - "label", - "include" - ], + "title": "StatsItem", "properties": { "id": { "type": "string" @@ -211,7 +134,7 @@ "type": "string" }, "value": { - "oneOf": [ + "anyOf": [ { "type": "boolean" }, @@ -230,20 +153,125 @@ "type": "boolean" }, "description": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null + } + }, + "additionalProperties": false, + "required": [ + "id", + "label", + "value", + "include" + ] + }, + "CatalogTable": { + "type": "object", + "title": "CatalogTable", + "properties": { + "metadata": { + "$ref": "#/$defs/TableMetadata" + }, + "columns": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/ColumnMetadata" + }, + "propertyNames": { + "type": "string" + } + }, + "stats": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/StatsItem" + }, + "propertyNames": { + "type": "string" + } + }, + "unique_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null } }, "additionalProperties": false, - "description": "StatsItem(id: str, label: str, value: Union[bool, str, float, NoneType], include: bool, description: Optional[str] = None)" + "required": [ + "metadata", + "columns", + "stats" + ] + }, + "CatalogArtifact": { + "type": "object", + "title": "CatalogArtifact", + "properties": { + "metadata": { + "$ref": "#/$defs/CatalogMetadata" + }, + "nodes": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/CatalogTable" + }, + "propertyNames": { + "type": "string" + } + }, + "sources": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/CatalogTable" + }, + "propertyNames": { + "type": "string" + } + }, + "errors": { + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "null" + } + ], + "default": null + }, + "_compile_results": { + "anyOf": [ + {}, + { + "type": "null" + } + ], + "default": null + } + }, + "additionalProperties": false, + "required": [ + "metadata", + "nodes", + "sources" + ] } }, - "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://schemas.getdbt.com/dbt/catalog/v1.json" } diff --git a/schemas/dbt/manifest/v11.json b/schemas/dbt/manifest/v11.json index 2f9c626e1ce..5bc21a93886 100644 --- a/schemas/dbt/manifest/v11.json +++ b/schemas/dbt/manifest/v11.json @@ -1,259 +1,42 @@ { - "type": "object", - "required": [ - "metadata", - "nodes", - "sources", - "macros", - "docs", - "exposures", - "metrics", - "groups", - "selectors", - "semantic_models" - ], - "properties": { - "metadata": { - "$ref": "#/definitions/ManifestMetadata", - "description": "Metadata about the manifest" - }, - "nodes": { - "type": "object", - "additionalProperties": { - "oneOf": [ - { - "$ref": "#/definitions/AnalysisNode" - }, - { - "$ref": "#/definitions/SingularTestNode" - }, - { - "$ref": "#/definitions/HookNode" - }, - { - "$ref": "#/definitions/ModelNode" - }, - { - "$ref": "#/definitions/RPCNode" - }, - { - "$ref": "#/definitions/SqlNode" - }, - { - "$ref": "#/definitions/GenericTestNode" - }, - { - "$ref": "#/definitions/SnapshotNode" - }, - { - "$ref": "#/definitions/SeedNode" - } - ] - }, - "description": "The nodes defined in the dbt project and its dependencies" - }, - "sources": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/SourceDefinition" - }, - "description": "The sources defined in the dbt project and its dependencies" - }, - "macros": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/Macro" - }, - "description": "The macros defined in the dbt project and its dependencies" - }, - "docs": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/Documentation" - }, - "description": "The docs defined in the dbt project and its dependencies" - }, - "exposures": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/Exposure" - }, - "description": "The exposures defined in the dbt project and its dependencies" - }, - "metrics": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/Metric" - }, - "description": "The metrics defined in the dbt project and its dependencies" - }, - "groups": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/Group" - }, - "description": "The groups defined in the dbt project" - }, - "selectors": { - "type": "object", - "description": "The selectors defined in selectors.yml" - }, - "disabled": { - "oneOf": [ - { - "type": "object", - "additionalProperties": { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/definitions/AnalysisNode" - }, - { - "$ref": "#/definitions/SingularTestNode" - }, - { - "$ref": "#/definitions/HookNode" - }, - { - "$ref": "#/definitions/ModelNode" - }, - { - "$ref": "#/definitions/RPCNode" - }, - { - "$ref": "#/definitions/SqlNode" - }, - { - "$ref": "#/definitions/GenericTestNode" - }, - { - "$ref": "#/definitions/SnapshotNode" - }, - { - "$ref": "#/definitions/SeedNode" - }, - { - "$ref": "#/definitions/SourceDefinition" - }, - { - "$ref": "#/definitions/Exposure" - }, - { - "$ref": "#/definitions/Metric" - }, - { - "$ref": "#/definitions/SemanticModel" - } - ] - } - } - }, - { - "type": "null" - } - ], - "description": "A mapping of the disabled nodes in the target" - }, - "parent_map": { - "oneOf": [ - { - "type": "object", - "additionalProperties": { - "type": "array", - "items": { - "type": "string" - } - } - }, - { - "type": "null" - } - ], - "description": "A mapping from\u00a0child nodes to their dependencies" - }, - "child_map": { - "oneOf": [ - { - "type": "object", - "additionalProperties": { - "type": "array", - "items": { - "type": "string" - } - } - }, - { - "type": "null" - } - ], - "description": "A mapping from parent nodes to their dependents" - }, - "group_map": { - "oneOf": [ - { - "type": "object", - "additionalProperties": { - "type": "array", - "items": { - "type": "string" - } - } - }, - { - "type": "null" - } - ], - "description": "A mapping from group names to their nodes" - }, - "semantic_models": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/SemanticModel" - }, - "description": "The semantic models defined in the dbt project" - } - }, - "additionalProperties": false, - "description": "WritableManifest(metadata: dbt.contracts.graph.manifest.ManifestMetadata, nodes: Mapping[str, Union[dbt.contracts.graph.nodes.AnalysisNode, dbt.contracts.graph.nodes.SingularTestNode, dbt.contracts.graph.nodes.HookNode, dbt.contracts.graph.nodes.ModelNode, dbt.contracts.graph.nodes.RPCNode, dbt.contracts.graph.nodes.SqlNode, dbt.contracts.graph.nodes.GenericTestNode, dbt.contracts.graph.nodes.SnapshotNode, dbt.contracts.graph.nodes.SeedNode]], sources: Mapping[str, dbt.contracts.graph.nodes.SourceDefinition], macros: Mapping[str, dbt.contracts.graph.nodes.Macro], docs: Mapping[str, dbt.contracts.graph.nodes.Documentation], exposures: Mapping[str, dbt.contracts.graph.nodes.Exposure], metrics: Mapping[str, dbt.contracts.graph.nodes.Metric], groups: Mapping[str, dbt.contracts.graph.nodes.Group], selectors: Mapping[str, Any], disabled: Union[Mapping[str, List[Union[dbt.contracts.graph.nodes.AnalysisNode, dbt.contracts.graph.nodes.SingularTestNode, dbt.contracts.graph.nodes.HookNode, dbt.contracts.graph.nodes.ModelNode, dbt.contracts.graph.nodes.RPCNode, dbt.contracts.graph.nodes.SqlNode, dbt.contracts.graph.nodes.GenericTestNode, dbt.contracts.graph.nodes.SnapshotNode, dbt.contracts.graph.nodes.SeedNode, dbt.contracts.graph.nodes.SourceDefinition, dbt.contracts.graph.nodes.Exposure, dbt.contracts.graph.nodes.Metric, dbt.contracts.graph.nodes.SemanticModel]]], NoneType], parent_map: Union[Dict[str, List[str]], NoneType], child_map: Union[Dict[str, List[str]], NoneType], group_map: Union[Dict[str, List[str]], NoneType], semantic_models: Mapping[str, dbt.contracts.graph.nodes.SemanticModel])", - "definitions": { + "$ref": "#/$defs/WritableManifest", + "$defs": { "ManifestMetadata": { "type": "object", - "required": [], + "title": "ManifestMetadata", "properties": { "dbt_schema_version": { - "type": "string", - "default": "https://schemas.getdbt.com/dbt/manifest/v11.json" + "type": "string" }, "dbt_version": { "type": "string", - "default": "1.7.0a1" + "default": "1.7.0b1" }, "generated_at": { - "type": "string", - "format": "date-time", - "default": "2023-08-07T20:39:59.293558Z" + "type": "string" }, "invocation_id": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ], - "default": "58eb10b1-36ce-4873-9081-8cb0c38ba438" + ] }, "env": { "type": "object", "additionalProperties": { "type": "string" }, - "default": {} + "propertyNames": { + "type": "string" + } }, "project_name": { - "oneOf": [ + "description": "Name of the root project", + "anyOf": [ { "type": "string" }, @@ -261,10 +44,11 @@ "type": "null" } ], - "description": "Name of the root project" + "default": null }, "project_id": { - "oneOf": [ + "description": "A unique identifier for the project, hashed from the project name", + "anyOf": [ { "type": "string" }, @@ -272,22 +56,24 @@ "type": "null" } ], - "description": "A unique identifier for the project, hashed from the project name" + "default": null }, "user_id": { - "oneOf": [ + "description": "A unique identifier for the user", + "anyOf": [ { "type": "string", - "pattern": "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}" + "format": "uuid" }, { "type": "null" } ], - "description": "A unique identifier for the user" + "default": null }, "send_anonymous_usage_stats": { - "oneOf": [ + "description": "Whether dbt is configured to send anonymous usage statistics", + "anyOf": [ { "type": "boolean" }, @@ -295,10 +81,11 @@ "type": "null" } ], - "description": "Whether dbt is configured to send anonymous usage statistics" + "default": null }, "adapter_type": { - "oneOf": [ + "description": "The type name of the adapter", + "anyOf": [ { "type": "string" }, @@ -306,413 +93,224 @@ "type": "null" } ], - "description": "The type name of the adapter" + "default": null } }, - "additionalProperties": false, - "description": "Metadata for the manifest." + "additionalProperties": false }, - "AnalysisNode": { + "FileHash": { "type": "object", + "title": "FileHash", + "properties": { + "name": { + "type": "string" + }, + "checksum": { + "type": "string" + } + }, + "additionalProperties": false, "required": [ - "schema", "name", - "resource_type", - "package_name", - "path", - "original_file_path", - "unique_id", - "fqn", - "alias", "checksum" - ], + ] + }, + "Hook": { + "type": "object", + "title": "Hook", "properties": { - "database": { - "oneOf": [ + "sql": { + "type": "string" + }, + "transaction": { + "type": "boolean", + "default": true + }, + "index": { + "anyOf": [ { - "type": "string" + "type": "integer" }, { "type": "null" } - ] - }, - "schema": { - "type": "string" - }, - "name": { - "type": "string" - }, - "resource_type": { - "type": "string", - "enum": [ - "analysis" - ] - }, - "package_name": { - "type": "string" - }, - "path": { - "type": "string" - }, - "original_file_path": { - "type": "string" - }, - "unique_id": { - "type": "string" + ], + "default": null + } + }, + "additionalProperties": false, + "required": [ + "sql" + ] + }, + "Docs": { + "type": "object", + "title": "Docs", + "properties": { + "show": { + "type": "boolean", + "default": true }, - "fqn": { - "type": "array", - "items": { + "node_color": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "additionalProperties": false + }, + "ContractConfig": { + "type": "object", + "title": "ContractConfig", + "properties": { + "enforced": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + }, + "NodeConfig": { + "type": "object", + "title": "NodeConfig", + "properties": { + "_extra": { + "type": "object", + "propertyNames": { "type": "string" } }, - "alias": { - "type": "string" - }, - "checksum": { - "$ref": "#/definitions/FileHash" - }, - "config": { - "$ref": "#/definitions/NodeConfig", - "default": { - "enabled": true, - "alias": null, - "schema": null, - "database": null, - "tags": [], - "meta": {}, - "group": null, - "materialized": "view", - "incremental_strategy": null, - "persist_docs": {}, - "quoting": {}, - "column_types": {}, - "full_refresh": null, - "unique_key": null, - "on_schema_change": "ignore", - "on_configuration_change": "apply", - "grants": {}, - "packages": [], - "docs": { - "show": true, - "node_color": null - }, - "contract": { - "enforced": false - }, - "post-hook": [], - "pre-hook": [] - } - }, - "tags": { - "type": "array", - "items": { - "type": "string" - }, - "default": [] - }, - "description": { - "type": "string", - "default": "" - }, - "columns": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/ColumnInfo" - }, - "default": {} - }, - "meta": { - "type": "object", - "default": {} + "enabled": { + "type": "boolean", + "default": true }, - "group": { - "oneOf": [ + "alias": { + "anyOf": [ { "type": "string" }, { "type": "null" } - ] - }, - "docs": { - "$ref": "#/definitions/Docs", - "default": { - "show": true, - "node_color": null - } + ], + "default": null }, - "patch_path": { - "oneOf": [ + "schema": { + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, - "build_path": { - "oneOf": [ + "database": { + "anyOf": [ { "type": "string" }, { "type": "null" } - ] - }, - "deferred": { - "type": "boolean", - "default": false - }, - "unrendered_config": { - "type": "object", - "default": {} + ], + "default": null }, - "created_at": { - "type": "number", - "default": 1691440799.299534 + "tags": { + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "string" + } + ] }, - "config_call_dict": { + "meta": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, - "relation_name": { - "oneOf": [ + "group": { + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, - "raw_code": { - "type": "string", - "default": "" - }, - "language": { - "type": "string", - "default": "sql" - }, - "refs": { - "type": "array", - "items": { - "$ref": "#/definitions/RefArgs" - }, - "default": [] - }, - "sources": { - "type": "array", - "items": { - "type": "array", - "items": { - "type": "string" - } - }, - "default": [] - }, - "metrics": { - "type": "array", - "items": { - "type": "array", - "items": { - "type": "string" - } - }, - "default": [] - }, - "depends_on": { - "$ref": "#/definitions/DependsOn", - "default": { - "macros": [], - "nodes": [] - } - }, - "compiled_path": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "compiled": { - "type": "boolean", - "default": false - }, - "compiled_code": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "extra_ctes_injected": { - "type": "boolean", - "default": false - }, - "extra_ctes": { - "type": "array", - "items": { - "$ref": "#/definitions/InjectedCTE" - }, - "default": [] - }, - "contract": { - "$ref": "#/definitions/Contract", - "default": { - "enforced": false, - "checksum": null - } - } - }, - "additionalProperties": false, - "description": "AnalysisNode(database: Union[str, NoneType], schema: str, name: str, resource_type: dbt.node_types.NodeType, package_name: str, path: str, original_file_path: str, unique_id: str, fqn: List[str], alias: str, checksum: dbt.contracts.files.FileHash, config: dbt.contracts.graph.model_config.NodeConfig = , _event_status: Dict[str, Any] = , tags: List[str] = , description: str = '', columns: Dict[str, dbt.contracts.graph.nodes.ColumnInfo] = , meta: Dict[str, Any] = , group: Union[str, NoneType] = None, docs: dbt.contracts.graph.unparsed.Docs = , patch_path: Union[str, NoneType] = None, build_path: Union[str, NoneType] = None, deferred: bool = False, unrendered_config: Dict[str, Any] = , created_at: float = , config_call_dict: Dict[str, Any] = , relation_name: Union[str, NoneType] = None, raw_code: str = '', language: str = 'sql', refs: List[dbt.contracts.graph.nodes.RefArgs] = , sources: List[List[str]] = , metrics: List[List[str]] = , depends_on: dbt.contracts.graph.nodes.DependsOn = , compiled_path: Union[str, NoneType] = None, compiled: bool = False, compiled_code: Union[str, NoneType] = None, extra_ctes_injected: bool = False, extra_ctes: List[dbt.contracts.graph.nodes.InjectedCTE] = , _pre_injected_sql: Union[str, NoneType] = None, contract: dbt.contracts.graph.nodes.Contract = )" - }, - "FileHash": { - "type": "object", - "required": [ - "name", - "checksum" - ], - "properties": { - "name": { - "type": "string" - }, - "checksum": { - "type": "string" - } - }, - "additionalProperties": false, - "description": "FileHash(name: str, checksum: str)" - }, - "NodeConfig": { - "type": "object", - "required": [], - "properties": { - "enabled": { - "type": "boolean", - "default": true - }, - "alias": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "schema": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "database": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "tags": { - "oneOf": [ - { - "type": "array", - "items": { - "type": "string" - } - }, - { - "type": "string" - } - ], - "default": [] - }, - "meta": { - "type": "object", - "default": {} - }, - "group": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "materialized": { + "materialized": { "type": "string", "default": "view" }, "incremental_strategy": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "persist_docs": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "post-hook": { "type": "array", "items": { - "$ref": "#/definitions/Hook" - }, - "default": [] + "$ref": "#/$defs/Hook" + } }, "pre-hook": { "type": "array", "items": { - "$ref": "#/definitions/Hook" - }, - "default": [] + "$ref": "#/$defs/Hook" + } }, "quoting": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "column_types": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "full_refresh": { - "oneOf": [ + "anyOf": [ { "type": "boolean" }, { "type": "null" } - ] + ], + "default": null }, "unique_key": { - "oneOf": [ + "anyOf": [ { "type": "string" }, @@ -725,10 +323,11 @@ { "type": "null" } - ] + ], + "default": null }, "on_schema_change": { - "oneOf": [ + "anyOf": [ { "type": "string" }, @@ -739,108 +338,86 @@ "default": "ignore" }, "on_configuration_change": { - "type": "string", "enum": [ "apply", "continue", "fail" - ], - "default": "apply" + ] }, "grants": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "packages": { "type": "array", "items": { "type": "string" - }, - "default": [] + } }, "docs": { - "$ref": "#/definitions/Docs", - "default": { - "show": true, - "node_color": null - } + "$ref": "#/$defs/Docs" }, "contract": { - "$ref": "#/definitions/ContractConfig", - "default": { - "enforced": false - } + "$ref": "#/$defs/ContractConfig" } }, - "additionalProperties": true, - "description": "NodeConfig(_extra: Dict[str, Any] = , enabled: bool = True, alias: Union[str, NoneType] = None, schema: Union[str, NoneType] = None, database: Union[str, NoneType] = None, tags: Union[List[str], str] = , meta: Dict[str, Any] = , group: Union[str, NoneType] = None, materialized: str = 'view', incremental_strategy: Union[str, NoneType] = None, persist_docs: Dict[str, Any] = , post_hook: List[dbt.contracts.graph.model_config.Hook] = , pre_hook: List[dbt.contracts.graph.model_config.Hook] = , quoting: Dict[str, Any] = , column_types: Dict[str, Any] = , full_refresh: Union[bool, NoneType] = None, unique_key: Union[str, List[str], NoneType] = None, on_schema_change: Union[str, NoneType] = 'ignore', on_configuration_change: dbt.contracts.graph.model_config.OnConfigurationChangeOption = , grants: Dict[str, Any] = , packages: List[str] = , docs: dbt.contracts.graph.unparsed.Docs = , contract: dbt.contracts.graph.model_config.ContractConfig = )" + "additionalProperties": true }, - "Hook": { + "ColumnLevelConstraint": { "type": "object", - "required": [ - "sql" - ], + "title": "ColumnLevelConstraint", "properties": { - "sql": { - "type": "string" - }, - "transaction": { - "type": "boolean", - "default": true + "type": { + "enum": [ + "check", + "not_null", + "unique", + "primary_key", + "foreign_key", + "custom" + ] }, - "index": { - "oneOf": [ + "name": { + "anyOf": [ { - "type": "integer" + "type": "string" }, { "type": "null" } - ] - } - }, - "additionalProperties": false, - "description": "Hook(sql: str, transaction: bool = True, index: Union[int, NoneType] = None)" - }, - "Docs": { - "type": "object", - "required": [], - "properties": { - "show": { - "type": "boolean", - "default": true + ], + "default": null }, - "node_color": { - "oneOf": [ + "expression": { + "anyOf": [ { "type": "string" }, { "type": "null" } - ] - } - }, - "additionalProperties": false, - "description": "Docs(show: bool = True, node_color: Union[str, NoneType] = None)" - }, - "ContractConfig": { - "type": "object", - "required": [], - "properties": { - "enforced": { + ], + "default": null + }, + "warn_unenforced": { "type": "boolean", - "default": false + "default": true + }, + "warn_unsupported": { + "type": "boolean", + "default": true } }, "additionalProperties": false, - "description": "ContractConfig(enforced: bool = False)" + "required": [ + "type" + ] }, "ColumnInfo": { "type": "object", - "required": [ - "name" - ], + "title": "ColumnInfo", "properties": { "name": { "type": "string" @@ -851,116 +428,76 @@ }, "meta": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "data_type": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "constraints": { "type": "array", "items": { - "$ref": "#/definitions/ColumnLevelConstraint" - }, - "default": [] + "$ref": "#/$defs/ColumnLevelConstraint" + } }, "quote": { - "oneOf": [ + "anyOf": [ { "type": "boolean" }, { "type": "null" } - ] + ], + "default": null }, "tags": { "type": "array", "items": { "type": "string" - }, - "default": [] + } + }, + "_extra": { + "type": "object", + "propertyNames": { + "type": "string" + } } }, "additionalProperties": true, - "description": "Used in all ManifestNodes and SourceDefinition" + "required": [ + "name" + ] }, - "ColumnLevelConstraint": { + "RefArgs": { "type": "object", - "required": [ - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "check", - "not_null", - "unique", - "primary_key", - "foreign_key", - "custom" - ] - }, - "name": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "expression": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "warn_unenforced": { - "type": "boolean", - "default": true - }, - "warn_unsupported": { - "type": "boolean", - "default": true - } - }, - "additionalProperties": false, - "description": "ColumnLevelConstraint(type: dbt.contracts.graph.nodes.ConstraintType, name: Union[str, NoneType] = None, expression: Union[str, NoneType] = None, warn_unenforced: bool = True, warn_unsupported: bool = True)" - }, - "RefArgs": { - "type": "object", - "required": [ - "name" - ], + "title": "RefArgs", "properties": { "name": { "type": "string" }, "package": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "version": { - "oneOf": [ + "anyOf": [ { "type": "string" }, @@ -970,40 +507,37 @@ { "type": "null" } - ] + ], + "default": null } }, "additionalProperties": false, - "description": "RefArgs(name: str, package: Union[str, NoneType] = None, version: Union[str, float, NoneType] = None)" + "required": [ + "name" + ] }, "DependsOn": { "type": "object", - "required": [], + "title": "DependsOn", "properties": { "macros": { "type": "array", "items": { "type": "string" - }, - "default": [] + } }, "nodes": { "type": "array", "items": { "type": "string" - }, - "default": [] + } } }, - "additionalProperties": false, - "description": "DependsOn(macros: List[str] = , nodes: List[str] = )" + "additionalProperties": false }, "InjectedCTE": { "type": "object", - "required": [ - "id", - "sql" - ], + "title": "InjectedCTE", "properties": { "id": { "type": "string" @@ -1013,47 +547,39 @@ } }, "additionalProperties": false, - "description": "Used in CompiledNodes as part of ephemeral model processing" + "required": [ + "id", + "sql" + ] }, "Contract": { "type": "object", - "required": [], + "title": "Contract", "properties": { "enforced": { "type": "boolean", "default": false }, "checksum": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null } }, - "additionalProperties": false, - "description": "Contract(enforced: bool = False, checksum: Union[str, NoneType] = None)" + "additionalProperties": false }, - "SingularTestNode": { + "AnalysisNode": { "type": "object", - "required": [ - "schema", - "name", - "resource_type", - "package_name", - "path", - "original_file_path", - "unique_id", - "fqn", - "alias", - "checksum" - ], + "title": "AnalysisNode", "properties": { "database": { - "oneOf": [ + "anyOf": [ { "type": "string" }, @@ -1069,10 +595,7 @@ "type": "string" }, "resource_type": { - "type": "string", - "enum": [ - "test" - ] + "const": "analysis" }, "package_name": { "type": "string" @@ -1096,34 +619,22 @@ "type": "string" }, "checksum": { - "$ref": "#/definitions/FileHash" + "$ref": "#/$defs/FileHash" }, "config": { - "$ref": "#/definitions/TestConfig", - "default": { - "enabled": true, - "alias": null, - "schema": "dbt_test__audit", - "database": null, - "tags": [], - "meta": {}, - "group": null, - "materialized": "test", - "severity": "ERROR", - "store_failures": null, - "where": null, - "limit": null, - "fail_calc": "count(*)", - "warn_if": "!= 0", - "error_if": "!= 0" + "$ref": "#/$defs/NodeConfig" + }, + "_event_status": { + "type": "object", + "propertyNames": { + "type": "string" } }, "tags": { "type": "array", "items": { "type": "string" - }, - "default": [] + } }, "description": { "type": "string", @@ -1132,50 +643,53 @@ "columns": { "type": "object", "additionalProperties": { - "$ref": "#/definitions/ColumnInfo" + "$ref": "#/$defs/ColumnInfo" }, - "default": {} + "propertyNames": { + "type": "string" + } }, "meta": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "group": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "docs": { - "$ref": "#/definitions/Docs", - "default": { - "show": true, - "node_color": null - } + "$ref": "#/$defs/Docs" }, "patch_path": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "build_path": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "deferred": { "type": "boolean", @@ -1183,25 +697,29 @@ }, "unrendered_config": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "created_at": { - "type": "number", - "default": 1691440799.302819 + "type": "number" }, "config_call_dict": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "relation_name": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "raw_code": { "type": "string", @@ -1214,9 +732,8 @@ "refs": { "type": "array", "items": { - "$ref": "#/definitions/RefArgs" - }, - "default": [] + "$ref": "#/$defs/RefArgs" + } }, "sources": { "type": "array", @@ -1225,8 +742,7 @@ "items": { "type": "string" } - }, - "default": [] + } }, "metrics": { "type": "array", @@ -1235,39 +751,36 @@ "items": { "type": "string" } - }, - "default": [] + } }, "depends_on": { - "$ref": "#/definitions/DependsOn", - "default": { - "macros": [], - "nodes": [] - } + "$ref": "#/$defs/DependsOn" }, "compiled_path": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "compiled": { "type": "boolean", "default": false }, "compiled_code": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "extra_ctes_injected": { "type": "boolean", @@ -1276,41 +789,66 @@ "extra_ctes": { "type": "array", "items": { - "$ref": "#/definitions/InjectedCTE" - }, - "default": [] + "$ref": "#/$defs/InjectedCTE" + } + }, + "_pre_injected_sql": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null }, "contract": { - "$ref": "#/definitions/Contract", - "default": { - "enforced": false, - "checksum": null - } + "$ref": "#/$defs/Contract" } }, "additionalProperties": false, - "description": "SingularTestNode(database: Union[str, NoneType], schema: str, name: str, resource_type: dbt.node_types.NodeType, package_name: str, path: str, original_file_path: str, unique_id: str, fqn: List[str], alias: str, checksum: dbt.contracts.files.FileHash, config: dbt.contracts.graph.model_config.TestConfig = , _event_status: Dict[str, Any] = , tags: List[str] = , description: str = '', columns: Dict[str, dbt.contracts.graph.nodes.ColumnInfo] = , meta: Dict[str, Any] = , group: Union[str, NoneType] = None, docs: dbt.contracts.graph.unparsed.Docs = , patch_path: Union[str, NoneType] = None, build_path: Union[str, NoneType] = None, deferred: bool = False, unrendered_config: Dict[str, Any] = , created_at: float = , config_call_dict: Dict[str, Any] = , relation_name: Union[str, NoneType] = None, raw_code: str = '', language: str = 'sql', refs: List[dbt.contracts.graph.nodes.RefArgs] = , sources: List[List[str]] = , metrics: List[List[str]] = , depends_on: dbt.contracts.graph.nodes.DependsOn = , compiled_path: Union[str, NoneType] = None, compiled: bool = False, compiled_code: Union[str, NoneType] = None, extra_ctes_injected: bool = False, extra_ctes: List[dbt.contracts.graph.nodes.InjectedCTE] = , _pre_injected_sql: Union[str, NoneType] = None, contract: dbt.contracts.graph.nodes.Contract = )" + "required": [ + "database", + "schema", + "name", + "resource_type", + "package_name", + "path", + "original_file_path", + "unique_id", + "fqn", + "alias", + "checksum" + ] }, "TestConfig": { "type": "object", - "required": [], + "title": "TestConfig", "properties": { + "_extra": { + "type": "object", + "propertyNames": { + "type": "string" + } + }, "enabled": { "type": "boolean", "default": true }, "alias": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "schema": { - "oneOf": [ + "anyOf": [ { "type": "string" }, @@ -1321,17 +859,18 @@ "default": "dbt_test__audit" }, "database": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "tags": { - "oneOf": [ + "anyOf": [ { "type": "array", "items": { @@ -1341,22 +880,24 @@ { "type": "string" } - ], - "default": [] + ] }, "meta": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "group": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "materialized": { "type": "string", @@ -1364,38 +905,41 @@ }, "severity": { "type": "string", - "pattern": "^([Ww][Aa][Rr][Nn]|[Ee][Rr][Rr][Oo][Rr])$", - "default": "ERROR" + "default": "ERROR", + "pattern": "^([Ww][Aa][Rr][Nn]|[Ee][Rr][Rr][Oo][Rr])$" }, "store_failures": { - "oneOf": [ + "anyOf": [ { "type": "boolean" }, { "type": "null" } - ] + ], + "default": null }, "where": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "limit": { - "oneOf": [ + "anyOf": [ { "type": "integer" }, { "type": "null" } - ] + ], + "default": null }, "fail_calc": { "type": "string", @@ -1410,26 +954,14 @@ "default": "!= 0" } }, - "additionalProperties": true, - "description": "TestConfig(_extra: Dict[str, Any] = , enabled: bool = True, alias: Union[str, NoneType] = None, schema: Union[str, NoneType] = 'dbt_test__audit', database: Union[str, NoneType] = None, tags: Union[List[str], str] = , meta: Dict[str, Any] = , group: Union[str, NoneType] = None, materialized: str = 'test', severity: dbt.contracts.graph.model_config.Severity = 'ERROR', store_failures: Union[bool, NoneType] = None, where: Union[str, NoneType] = None, limit: Union[int, NoneType] = None, fail_calc: str = 'count(*)', warn_if: str = '!= 0', error_if: str = '!= 0')" + "additionalProperties": true }, - "HookNode": { + "SingularTestNode": { "type": "object", - "required": [ - "schema", - "name", - "resource_type", - "package_name", - "path", - "original_file_path", - "unique_id", - "fqn", - "alias", - "checksum" - ], + "title": "SingularTestNode", "properties": { "database": { - "oneOf": [ + "anyOf": [ { "type": "string" }, @@ -1445,10 +977,7 @@ "type": "string" }, "resource_type": { - "type": "string", - "enum": [ - "operation" - ] + "const": "test" }, "package_name": { "type": "string" @@ -1472,46 +1001,22 @@ "type": "string" }, "checksum": { - "$ref": "#/definitions/FileHash" + "$ref": "#/$defs/FileHash" }, "config": { - "$ref": "#/definitions/NodeConfig", - "default": { - "enabled": true, - "alias": null, - "schema": null, - "database": null, - "tags": [], - "meta": {}, - "group": null, - "materialized": "view", - "incremental_strategy": null, - "persist_docs": {}, - "quoting": {}, - "column_types": {}, - "full_refresh": null, - "unique_key": null, - "on_schema_change": "ignore", - "on_configuration_change": "apply", - "grants": {}, - "packages": [], - "docs": { - "show": true, - "node_color": null - }, - "contract": { - "enforced": false - }, - "post-hook": [], - "pre-hook": [] + "$ref": "#/$defs/TestConfig" + }, + "_event_status": { + "type": "object", + "propertyNames": { + "type": "string" } }, "tags": { "type": "array", "items": { "type": "string" - }, - "default": [] + } }, "description": { "type": "string", @@ -1520,50 +1025,53 @@ "columns": { "type": "object", "additionalProperties": { - "$ref": "#/definitions/ColumnInfo" + "$ref": "#/$defs/ColumnInfo" }, - "default": {} + "propertyNames": { + "type": "string" + } }, "meta": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "group": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "docs": { - "$ref": "#/definitions/Docs", - "default": { - "show": true, - "node_color": null - } + "$ref": "#/$defs/Docs" }, "patch_path": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "build_path": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "deferred": { "type": "boolean", @@ -1571,25 +1079,29 @@ }, "unrendered_config": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "created_at": { - "type": "number", - "default": 1691440799.304547 + "type": "number" }, "config_call_dict": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "relation_name": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "raw_code": { "type": "string", @@ -1602,9 +1114,8 @@ "refs": { "type": "array", "items": { - "$ref": "#/definitions/RefArgs" - }, - "default": [] + "$ref": "#/$defs/RefArgs" + } }, "sources": { "type": "array", @@ -1613,8 +1124,7 @@ "items": { "type": "string" } - }, - "default": [] + } }, "metrics": { "type": "array", @@ -1623,39 +1133,36 @@ "items": { "type": "string" } - }, - "default": [] + } }, "depends_on": { - "$ref": "#/definitions/DependsOn", - "default": { - "macros": [], - "nodes": [] - } + "$ref": "#/$defs/DependsOn" }, "compiled_path": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "compiled": { "type": "boolean", "default": false }, "compiled_code": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "extra_ctes_injected": { "type": "boolean", @@ -1664,34 +1171,27 @@ "extra_ctes": { "type": "array", "items": { - "$ref": "#/definitions/InjectedCTE" - }, - "default": [] - }, - "contract": { - "$ref": "#/definitions/Contract", - "default": { - "enforced": false, - "checksum": null + "$ref": "#/$defs/InjectedCTE" } }, - "index": { - "oneOf": [ + "_pre_injected_sql": { + "anyOf": [ { - "type": "integer" + "type": "string" }, { "type": "null" } - ] + ], + "default": null + }, + "contract": { + "$ref": "#/$defs/Contract" } }, "additionalProperties": false, - "description": "HookNode(database: Union[str, NoneType], schema: str, name: str, resource_type: dbt.node_types.NodeType, package_name: str, path: str, original_file_path: str, unique_id: str, fqn: List[str], alias: str, checksum: dbt.contracts.files.FileHash, config: dbt.contracts.graph.model_config.NodeConfig = , _event_status: Dict[str, Any] = , tags: List[str] = , description: str = '', columns: Dict[str, dbt.contracts.graph.nodes.ColumnInfo] = , meta: Dict[str, Any] = , group: Union[str, NoneType] = None, docs: dbt.contracts.graph.unparsed.Docs = , patch_path: Union[str, NoneType] = None, build_path: Union[str, NoneType] = None, deferred: bool = False, unrendered_config: Dict[str, Any] = , created_at: float = , config_call_dict: Dict[str, Any] = , relation_name: Union[str, NoneType] = None, raw_code: str = '', language: str = 'sql', refs: List[dbt.contracts.graph.nodes.RefArgs] = , sources: List[List[str]] = , metrics: List[List[str]] = , depends_on: dbt.contracts.graph.nodes.DependsOn = , compiled_path: Union[str, NoneType] = None, compiled: bool = False, compiled_code: Union[str, NoneType] = None, extra_ctes_injected: bool = False, extra_ctes: List[dbt.contracts.graph.nodes.InjectedCTE] = , _pre_injected_sql: Union[str, NoneType] = None, contract: dbt.contracts.graph.nodes.Contract = , index: Union[int, NoneType] = None)" - }, - "ModelNode": { - "type": "object", "required": [ + "database", "schema", "name", "resource_type", @@ -1702,10 +1202,14 @@ "fqn", "alias", "checksum" - ], + ] + }, + "HookNode": { + "type": "object", + "title": "HookNode", "properties": { "database": { - "oneOf": [ + "anyOf": [ { "type": "string" }, @@ -1721,10 +1225,7 @@ "type": "string" }, "resource_type": { - "type": "string", - "enum": [ - "model" - ] + "const": "operation" }, "package_name": { "type": "string" @@ -1748,46 +1249,22 @@ "type": "string" }, "checksum": { - "$ref": "#/definitions/FileHash" + "$ref": "#/$defs/FileHash" }, "config": { - "$ref": "#/definitions/NodeConfig", - "default": { - "enabled": true, - "alias": null, - "schema": null, - "database": null, - "tags": [], - "meta": {}, - "group": null, - "materialized": "view", - "incremental_strategy": null, - "persist_docs": {}, - "quoting": {}, - "column_types": {}, - "full_refresh": null, - "unique_key": null, - "on_schema_change": "ignore", - "on_configuration_change": "apply", - "grants": {}, - "packages": [], - "docs": { - "show": true, - "node_color": null - }, - "contract": { - "enforced": false - }, - "post-hook": [], - "pre-hook": [] + "$ref": "#/$defs/NodeConfig" + }, + "_event_status": { + "type": "object", + "propertyNames": { + "type": "string" } }, "tags": { "type": "array", "items": { "type": "string" - }, - "default": [] + } }, "description": { "type": "string", @@ -1796,50 +1273,53 @@ "columns": { "type": "object", "additionalProperties": { - "$ref": "#/definitions/ColumnInfo" + "$ref": "#/$defs/ColumnInfo" }, - "default": {} + "propertyNames": { + "type": "string" + } }, "meta": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "group": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "docs": { - "$ref": "#/definitions/Docs", - "default": { - "show": true, - "node_color": null - } + "$ref": "#/$defs/Docs" }, "patch_path": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "build_path": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "deferred": { "type": "boolean", @@ -1847,25 +1327,29 @@ }, "unrendered_config": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "created_at": { - "type": "number", - "default": 1691440799.306247 + "type": "number" }, "config_call_dict": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "relation_name": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "raw_code": { "type": "string", @@ -1878,9 +1362,8 @@ "refs": { "type": "array", "items": { - "$ref": "#/definitions/RefArgs" - }, - "default": [] + "$ref": "#/$defs/RefArgs" + } }, "sources": { "type": "array", @@ -1889,8 +1372,7 @@ "items": { "type": "string" } - }, - "default": [] + } }, "metrics": { "type": "array", @@ -1899,39 +1381,36 @@ "items": { "type": "string" } - }, - "default": [] + } }, "depends_on": { - "$ref": "#/definitions/DependsOn", - "default": { - "macros": [], - "nodes": [] - } + "$ref": "#/$defs/DependsOn" }, "compiled_path": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "compiled": { "type": "boolean", "default": false }, "compiled_code": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "extra_ctes_injected": { "type": "boolean", @@ -1940,92 +1419,55 @@ "extra_ctes": { "type": "array", "items": { - "$ref": "#/definitions/InjectedCTE" - }, - "default": [] - }, - "contract": { - "$ref": "#/definitions/Contract", - "default": { - "enforced": false, - "checksum": null + "$ref": "#/$defs/InjectedCTE" } }, - "access": { - "type": "string", - "enum": [ - "protected", - "private", - "public" - ], - "default": "protected" - }, - "constraints": { - "type": "array", - "items": { - "$ref": "#/definitions/ModelLevelConstraint" - }, - "default": [] - }, - "version": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "number" - }, - { - "type": "null" - } - ] - }, - "latest_version": { - "oneOf": [ + "_pre_injected_sql": { + "anyOf": [ { "type": "string" }, - { - "type": "number" - }, { "type": "null" } - ] + ], + "default": null }, - "deprecation_date": { - "oneOf": [ - { - "type": "string", - "format": "date-time" - }, - { - "type": "null" - } - ] + "contract": { + "$ref": "#/$defs/Contract" }, - "defer_relation": { - "oneOf": [ + "index": { + "anyOf": [ { - "$ref": "#/definitions/DeferRelation" + "type": "integer" }, { "type": "null" } - ] + ], + "default": null } }, "additionalProperties": false, - "description": "ModelNode(database: Union[str, NoneType], schema: str, name: str, resource_type: dbt.node_types.NodeType, package_name: str, path: str, original_file_path: str, unique_id: str, fqn: List[str], alias: str, checksum: dbt.contracts.files.FileHash, config: dbt.contracts.graph.model_config.NodeConfig = , _event_status: Dict[str, Any] = , tags: List[str] = , description: str = '', columns: Dict[str, dbt.contracts.graph.nodes.ColumnInfo] = , meta: Dict[str, Any] = , group: Union[str, NoneType] = None, docs: dbt.contracts.graph.unparsed.Docs = , patch_path: Union[str, NoneType] = None, build_path: Union[str, NoneType] = None, deferred: bool = False, unrendered_config: Dict[str, Any] = , created_at: float = , config_call_dict: Dict[str, Any] = , relation_name: Union[str, NoneType] = None, raw_code: str = '', language: str = 'sql', refs: List[dbt.contracts.graph.nodes.RefArgs] = , sources: List[List[str]] = , metrics: List[List[str]] = , depends_on: dbt.contracts.graph.nodes.DependsOn = , compiled_path: Union[str, NoneType] = None, compiled: bool = False, compiled_code: Union[str, NoneType] = None, extra_ctes_injected: bool = False, extra_ctes: List[dbt.contracts.graph.nodes.InjectedCTE] = , _pre_injected_sql: Union[str, NoneType] = None, contract: dbt.contracts.graph.nodes.Contract = , access: dbt.node_types.AccessType = , constraints: List[dbt.contracts.graph.nodes.ModelLevelConstraint] = , version: Union[str, float, NoneType] = None, latest_version: Union[str, float, NoneType] = None, deprecation_date: Union[datetime.datetime, NoneType] = None, defer_relation: Union[dbt.contracts.graph.nodes.DeferRelation, NoneType] = None)" + "required": [ + "database", + "schema", + "name", + "resource_type", + "package_name", + "path", + "original_file_path", + "unique_id", + "fqn", + "alias", + "checksum" + ] }, "ModelLevelConstraint": { "type": "object", - "required": [ - "type" - ], + "title": "ModelLevelConstraint", "properties": { "type": { - "type": "string", "enum": [ "check", "not_null", @@ -2036,24 +1478,26 @@ ] }, "name": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "expression": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "warn_unenforced": { "type": "boolean", @@ -2067,22 +1511,20 @@ "type": "array", "items": { "type": "string" - }, - "default": [] + } } }, "additionalProperties": false, - "description": "ModelLevelConstraint(type: dbt.contracts.graph.nodes.ConstraintType, name: Union[str, NoneType] = None, expression: Union[str, NoneType] = None, warn_unenforced: bool = True, warn_unsupported: bool = True, columns: List[str] = )" + "required": [ + "type" + ] }, "DeferRelation": { "type": "object", - "required": [ - "schema", - "alias" - ], + "title": "DeferRelation", "properties": { "database": { - "oneOf": [ + "anyOf": [ { "type": "string" }, @@ -2098,7 +1540,7 @@ "type": "string" }, "relation_name": { - "oneOf": [ + "anyOf": [ { "type": "string" }, @@ -2109,25 +1551,19 @@ } }, "additionalProperties": false, - "description": "DeferRelation(database: Union[str, NoneType], schema: str, alias: str, relation_name: Union[str, NoneType])" - }, - "RPCNode": { - "type": "object", "required": [ + "database", "schema", - "name", - "resource_type", - "package_name", - "path", - "original_file_path", - "unique_id", - "fqn", "alias", - "checksum" - ], + "relation_name" + ] + }, + "ModelNode": { + "type": "object", + "title": "ModelNode", "properties": { "database": { - "oneOf": [ + "anyOf": [ { "type": "string" }, @@ -2143,10 +1579,7 @@ "type": "string" }, "resource_type": { - "type": "string", - "enum": [ - "rpc" - ] + "const": "model" }, "package_name": { "type": "string" @@ -2170,46 +1603,22 @@ "type": "string" }, "checksum": { - "$ref": "#/definitions/FileHash" + "$ref": "#/$defs/FileHash" }, "config": { - "$ref": "#/definitions/NodeConfig", - "default": { - "enabled": true, - "alias": null, - "schema": null, - "database": null, - "tags": [], - "meta": {}, - "group": null, - "materialized": "view", - "incremental_strategy": null, - "persist_docs": {}, - "quoting": {}, - "column_types": {}, - "full_refresh": null, - "unique_key": null, - "on_schema_change": "ignore", - "on_configuration_change": "apply", - "grants": {}, - "packages": [], - "docs": { - "show": true, - "node_color": null - }, - "contract": { - "enforced": false - }, - "post-hook": [], - "pre-hook": [] + "$ref": "#/$defs/NodeConfig" + }, + "_event_status": { + "type": "object", + "propertyNames": { + "type": "string" } }, "tags": { "type": "array", "items": { "type": "string" - }, - "default": [] + } }, "description": { "type": "string", @@ -2218,50 +1627,53 @@ "columns": { "type": "object", "additionalProperties": { - "$ref": "#/definitions/ColumnInfo" + "$ref": "#/$defs/ColumnInfo" }, - "default": {} + "propertyNames": { + "type": "string" + } }, "meta": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "group": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "docs": { - "$ref": "#/definitions/Docs", - "default": { - "show": true, - "node_color": null - } + "$ref": "#/$defs/Docs" }, "patch_path": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "build_path": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "deferred": { "type": "boolean", @@ -2269,25 +1681,29 @@ }, "unrendered_config": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "created_at": { - "type": "number", - "default": 1691440799.3088052 + "type": "number" }, "config_call_dict": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "relation_name": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "raw_code": { "type": "string", @@ -2300,9 +1716,8 @@ "refs": { "type": "array", "items": { - "$ref": "#/definitions/RefArgs" - }, - "default": [] + "$ref": "#/$defs/RefArgs" + } }, "sources": { "type": "array", @@ -2311,8 +1726,7 @@ "items": { "type": "string" } - }, - "default": [] + } }, "metrics": { "type": "array", @@ -2321,39 +1735,36 @@ "items": { "type": "string" } - }, - "default": [] + } }, "depends_on": { - "$ref": "#/definitions/DependsOn", - "default": { - "macros": [], - "nodes": [] - } + "$ref": "#/$defs/DependsOn" }, "compiled_path": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "compiled": { "type": "boolean", "default": false }, "compiled_code": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "extra_ctes_injected": { "type": "boolean", @@ -2362,24 +1773,92 @@ "extra_ctes": { "type": "array", "items": { - "$ref": "#/definitions/InjectedCTE" - }, - "default": [] + "$ref": "#/$defs/InjectedCTE" + } + }, + "_pre_injected_sql": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null }, "contract": { - "$ref": "#/definitions/Contract", - "default": { - "enforced": false, - "checksum": null + "$ref": "#/$defs/Contract" + }, + "access": { + "enum": [ + "private", + "protected", + "public" + ], + "default": "protected" + }, + "constraints": { + "type": "array", + "items": { + "$ref": "#/$defs/ModelLevelConstraint" } + }, + "version": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null + }, + "latest_version": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null + }, + "deprecation_date": { + "anyOf": [ + { + "type": "string", + "format": "date-time" + }, + { + "type": "null" + } + ], + "default": null + }, + "defer_relation": { + "anyOf": [ + { + "$ref": "#/$defs/DeferRelation" + }, + { + "type": "null" + } + ], + "default": null } }, "additionalProperties": false, - "description": "RPCNode(database: Union[str, NoneType], schema: str, name: str, resource_type: dbt.node_types.NodeType, package_name: str, path: str, original_file_path: str, unique_id: str, fqn: List[str], alias: str, checksum: dbt.contracts.files.FileHash, config: dbt.contracts.graph.model_config.NodeConfig = , _event_status: Dict[str, Any] = , tags: List[str] = , description: str = '', columns: Dict[str, dbt.contracts.graph.nodes.ColumnInfo] = , meta: Dict[str, Any] = , group: Union[str, NoneType] = None, docs: dbt.contracts.graph.unparsed.Docs = , patch_path: Union[str, NoneType] = None, build_path: Union[str, NoneType] = None, deferred: bool = False, unrendered_config: Dict[str, Any] = , created_at: float = , config_call_dict: Dict[str, Any] = , relation_name: Union[str, NoneType] = None, raw_code: str = '', language: str = 'sql', refs: List[dbt.contracts.graph.nodes.RefArgs] = , sources: List[List[str]] = , metrics: List[List[str]] = , depends_on: dbt.contracts.graph.nodes.DependsOn = , compiled_path: Union[str, NoneType] = None, compiled: bool = False, compiled_code: Union[str, NoneType] = None, extra_ctes_injected: bool = False, extra_ctes: List[dbt.contracts.graph.nodes.InjectedCTE] = , _pre_injected_sql: Union[str, NoneType] = None, contract: dbt.contracts.graph.nodes.Contract = )" - }, - "SqlNode": { - "type": "object", "required": [ + "database", "schema", "name", "resource_type", @@ -2390,10 +1869,14 @@ "fqn", "alias", "checksum" - ], + ] + }, + "RPCNode": { + "type": "object", + "title": "RPCNode", "properties": { "database": { - "oneOf": [ + "anyOf": [ { "type": "string" }, @@ -2409,10 +1892,7 @@ "type": "string" }, "resource_type": { - "type": "string", - "enum": [ - "sql_operation" - ] + "const": "rpc" }, "package_name": { "type": "string" @@ -2436,46 +1916,22 @@ "type": "string" }, "checksum": { - "$ref": "#/definitions/FileHash" + "$ref": "#/$defs/FileHash" }, "config": { - "$ref": "#/definitions/NodeConfig", - "default": { - "enabled": true, - "alias": null, - "schema": null, - "database": null, - "tags": [], - "meta": {}, - "group": null, - "materialized": "view", - "incremental_strategy": null, - "persist_docs": {}, - "quoting": {}, - "column_types": {}, - "full_refresh": null, - "unique_key": null, - "on_schema_change": "ignore", - "on_configuration_change": "apply", - "grants": {}, - "packages": [], - "docs": { - "show": true, - "node_color": null - }, - "contract": { - "enforced": false - }, - "post-hook": [], - "pre-hook": [] + "$ref": "#/$defs/NodeConfig" + }, + "_event_status": { + "type": "object", + "propertyNames": { + "type": "string" } }, "tags": { "type": "array", "items": { "type": "string" - }, - "default": [] + } }, "description": { "type": "string", @@ -2484,50 +1940,53 @@ "columns": { "type": "object", "additionalProperties": { - "$ref": "#/definitions/ColumnInfo" + "$ref": "#/$defs/ColumnInfo" }, - "default": {} + "propertyNames": { + "type": "string" + } }, "meta": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "group": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "docs": { - "$ref": "#/definitions/Docs", - "default": { - "show": true, - "node_color": null - } + "$ref": "#/$defs/Docs" }, "patch_path": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "build_path": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "deferred": { "type": "boolean", @@ -2535,25 +1994,29 @@ }, "unrendered_config": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "created_at": { - "type": "number", - "default": 1691440799.310445 + "type": "number" }, "config_call_dict": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "relation_name": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "raw_code": { "type": "string", @@ -2566,9 +2029,8 @@ "refs": { "type": "array", "items": { - "$ref": "#/definitions/RefArgs" - }, - "default": [] + "$ref": "#/$defs/RefArgs" + } }, "sources": { "type": "array", @@ -2577,8 +2039,7 @@ "items": { "type": "string" } - }, - "default": [] + } }, "metrics": { "type": "array", @@ -2587,39 +2048,36 @@ "items": { "type": "string" } - }, - "default": [] + } }, "depends_on": { - "$ref": "#/definitions/DependsOn", - "default": { - "macros": [], - "nodes": [] - } + "$ref": "#/$defs/DependsOn" }, "compiled_path": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "compiled": { "type": "boolean", "default": false }, "compiled_code": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "extra_ctes_injected": { "type": "boolean", @@ -2628,25 +2086,27 @@ "extra_ctes": { "type": "array", "items": { - "$ref": "#/definitions/InjectedCTE" - }, - "default": [] + "$ref": "#/$defs/InjectedCTE" + } + }, + "_pre_injected_sql": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null }, "contract": { - "$ref": "#/definitions/Contract", - "default": { - "enforced": false, - "checksum": null - } + "$ref": "#/$defs/Contract" } }, "additionalProperties": false, - "description": "SqlNode(database: Union[str, NoneType], schema: str, name: str, resource_type: dbt.node_types.NodeType, package_name: str, path: str, original_file_path: str, unique_id: str, fqn: List[str], alias: str, checksum: dbt.contracts.files.FileHash, config: dbt.contracts.graph.model_config.NodeConfig = , _event_status: Dict[str, Any] = , tags: List[str] = , description: str = '', columns: Dict[str, dbt.contracts.graph.nodes.ColumnInfo] = , meta: Dict[str, Any] = , group: Union[str, NoneType] = None, docs: dbt.contracts.graph.unparsed.Docs = , patch_path: Union[str, NoneType] = None, build_path: Union[str, NoneType] = None, deferred: bool = False, unrendered_config: Dict[str, Any] = , created_at: float = , config_call_dict: Dict[str, Any] = , relation_name: Union[str, NoneType] = None, raw_code: str = '', language: str = 'sql', refs: List[dbt.contracts.graph.nodes.RefArgs] = , sources: List[List[str]] = , metrics: List[List[str]] = , depends_on: dbt.contracts.graph.nodes.DependsOn = , compiled_path: Union[str, NoneType] = None, compiled: bool = False, compiled_code: Union[str, NoneType] = None, extra_ctes_injected: bool = False, extra_ctes: List[dbt.contracts.graph.nodes.InjectedCTE] = , _pre_injected_sql: Union[str, NoneType] = None, contract: dbt.contracts.graph.nodes.Contract = )" - }, - "GenericTestNode": { - "type": "object", "required": [ - "test_metadata", + "database", "schema", "name", "resource_type", @@ -2657,13 +2117,14 @@ "fqn", "alias", "checksum" - ], + ] + }, + "SqlNode": { + "type": "object", + "title": "SqlNode", "properties": { - "test_metadata": { - "$ref": "#/definitions/TestMetadata" - }, "database": { - "oneOf": [ + "anyOf": [ { "type": "string" }, @@ -2679,10 +2140,7 @@ "type": "string" }, "resource_type": { - "type": "string", - "enum": [ - "test" - ] + "const": "sql_operation" }, "package_name": { "type": "string" @@ -2706,34 +2164,22 @@ "type": "string" }, "checksum": { - "$ref": "#/definitions/FileHash" + "$ref": "#/$defs/FileHash" }, "config": { - "$ref": "#/definitions/TestConfig", - "default": { - "enabled": true, - "alias": null, - "schema": "dbt_test__audit", - "database": null, - "tags": [], - "meta": {}, - "group": null, - "materialized": "test", - "severity": "ERROR", - "store_failures": null, - "where": null, - "limit": null, - "fail_calc": "count(*)", - "warn_if": "!= 0", - "error_if": "!= 0" + "$ref": "#/$defs/NodeConfig" + }, + "_event_status": { + "type": "object", + "propertyNames": { + "type": "string" } }, "tags": { "type": "array", "items": { "type": "string" - }, - "default": [] + } }, "description": { "type": "string", @@ -2742,50 +2188,53 @@ "columns": { "type": "object", "additionalProperties": { - "$ref": "#/definitions/ColumnInfo" + "$ref": "#/$defs/ColumnInfo" }, - "default": {} + "propertyNames": { + "type": "string" + } }, "meta": { "type": "object", - "default": {} - }, + "propertyNames": { + "type": "string" + } + }, "group": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "docs": { - "$ref": "#/definitions/Docs", - "default": { - "show": true, - "node_color": null - } + "$ref": "#/$defs/Docs" }, "patch_path": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "build_path": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "deferred": { "type": "boolean", @@ -2793,25 +2242,29 @@ }, "unrendered_config": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "created_at": { - "type": "number", - "default": 1691440799.3122811 + "type": "number" }, "config_call_dict": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "relation_name": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "raw_code": { "type": "string", @@ -2824,9 +2277,8 @@ "refs": { "type": "array", "items": { - "$ref": "#/definitions/RefArgs" - }, - "default": [] + "$ref": "#/$defs/RefArgs" + } }, "sources": { "type": "array", @@ -2835,8 +2287,7 @@ "items": { "type": "string" } - }, - "default": [] + } }, "metrics": { "type": "array", @@ -2845,39 +2296,36 @@ "items": { "type": "string" } - }, - "default": [] + } }, "depends_on": { - "$ref": "#/definitions/DependsOn", - "default": { - "macros": [], - "nodes": [] - } + "$ref": "#/$defs/DependsOn" }, "compiled_path": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "compiled": { "type": "boolean", "default": false }, "compiled_code": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "extra_ctes_injected": { "type": "boolean", @@ -2886,96 +2334,78 @@ "extra_ctes": { "type": "array", "items": { - "$ref": "#/definitions/InjectedCTE" - }, - "default": [] - }, - "contract": { - "$ref": "#/definitions/Contract", - "default": { - "enforced": false, - "checksum": null + "$ref": "#/$defs/InjectedCTE" } }, - "column_name": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "file_key_name": { - "oneOf": [ + "_pre_injected_sql": { + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, - "attached_node": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "contract": { + "$ref": "#/$defs/Contract" } }, "additionalProperties": false, - "description": "GenericTestNode(test_metadata: dbt.contracts.graph.nodes.TestMetadata, database: Union[str, NoneType], schema: str, name: str, resource_type: dbt.node_types.NodeType, package_name: str, path: str, original_file_path: str, unique_id: str, fqn: List[str], alias: str, checksum: dbt.contracts.files.FileHash, config: dbt.contracts.graph.model_config.TestConfig = , _event_status: Dict[str, Any] = , tags: List[str] = , description: str = '', columns: Dict[str, dbt.contracts.graph.nodes.ColumnInfo] = , meta: Dict[str, Any] = , group: Union[str, NoneType] = None, docs: dbt.contracts.graph.unparsed.Docs = , patch_path: Union[str, NoneType] = None, build_path: Union[str, NoneType] = None, deferred: bool = False, unrendered_config: Dict[str, Any] = , created_at: float = , config_call_dict: Dict[str, Any] = , relation_name: Union[str, NoneType] = None, raw_code: str = '', language: str = 'sql', refs: List[dbt.contracts.graph.nodes.RefArgs] = , sources: List[List[str]] = , metrics: List[List[str]] = , depends_on: dbt.contracts.graph.nodes.DependsOn = , compiled_path: Union[str, NoneType] = None, compiled: bool = False, compiled_code: Union[str, NoneType] = None, extra_ctes_injected: bool = False, extra_ctes: List[dbt.contracts.graph.nodes.InjectedCTE] = , _pre_injected_sql: Union[str, NoneType] = None, contract: dbt.contracts.graph.nodes.Contract = , column_name: Union[str, NoneType] = None, file_key_name: Union[str, NoneType] = None, attached_node: Union[str, NoneType] = None)" + "required": [ + "database", + "schema", + "name", + "resource_type", + "package_name", + "path", + "original_file_path", + "unique_id", + "fqn", + "alias", + "checksum" + ] }, "TestMetadata": { "type": "object", - "required": [ - "name" - ], + "title": "TestMetadata", "properties": { "name": { "type": "string" }, "kwargs": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "namespace": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null } }, "additionalProperties": false, - "description": "TestMetadata(name: str, kwargs: Dict[str, Any] = , namespace: Union[str, NoneType] = None)" + "required": [ + "name" + ] }, - "SnapshotNode": { + "GenericTestNode": { "type": "object", - "required": [ - "schema", - "name", - "resource_type", - "package_name", - "path", - "original_file_path", - "unique_id", - "fqn", - "alias", - "checksum", - "config" - ], + "title": "GenericTestNode", "properties": { + "test_metadata": { + "$ref": "#/$defs/TestMetadata" + }, "database": { - "oneOf": [ + "anyOf": [ { "type": "string" }, @@ -2991,10 +2421,7 @@ "type": "string" }, "resource_type": { - "type": "string", - "enum": [ - "snapshot" - ] + "const": "test" }, "package_name": { "type": "string" @@ -3018,17 +2445,22 @@ "type": "string" }, "checksum": { - "$ref": "#/definitions/FileHash" + "$ref": "#/$defs/FileHash" }, "config": { - "$ref": "#/definitions/SnapshotConfig" + "$ref": "#/$defs/TestConfig" + }, + "_event_status": { + "type": "object", + "propertyNames": { + "type": "string" + } }, "tags": { "type": "array", "items": { "type": "string" - }, - "default": [] + } }, "description": { "type": "string", @@ -3037,50 +2469,53 @@ "columns": { "type": "object", "additionalProperties": { - "$ref": "#/definitions/ColumnInfo" + "$ref": "#/$defs/ColumnInfo" }, - "default": {} + "propertyNames": { + "type": "string" + } }, "meta": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "group": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "docs": { - "$ref": "#/definitions/Docs", - "default": { - "show": true, - "node_color": null - } + "$ref": "#/$defs/Docs" }, "patch_path": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "build_path": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "deferred": { "type": "boolean", @@ -3088,25 +2523,29 @@ }, "unrendered_config": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "created_at": { - "type": "number", - "default": 1691440799.315573 + "type": "number" }, "config_call_dict": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "relation_name": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "raw_code": { "type": "string", @@ -3119,9 +2558,8 @@ "refs": { "type": "array", "items": { - "$ref": "#/definitions/RefArgs" - }, - "default": [] + "$ref": "#/$defs/RefArgs" + } }, "sources": { "type": "array", @@ -3130,8 +2568,7 @@ "items": { "type": "string" } - }, - "default": [] + } }, "metrics": { "type": "array", @@ -3140,39 +2577,36 @@ "items": { "type": "string" } - }, - "default": [] + } }, "depends_on": { - "$ref": "#/definitions/DependsOn", - "default": { - "macros": [], - "nodes": [] - } + "$ref": "#/$defs/DependsOn" }, "compiled_path": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "compiled": { "type": "boolean", "default": false }, "compiled_code": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "extra_ctes_injected": { "type": "boolean", @@ -3181,71 +2615,122 @@ "extra_ctes": { "type": "array", "items": { - "$ref": "#/definitions/InjectedCTE" - }, - "default": [] + "$ref": "#/$defs/InjectedCTE" + } + }, + "_pre_injected_sql": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null }, "contract": { - "$ref": "#/definitions/Contract", - "default": { - "enforced": false, - "checksum": null - } + "$ref": "#/$defs/Contract" }, - "defer_relation": { - "oneOf": [ + "column_name": { + "anyOf": [ { - "$ref": "#/definitions/DeferRelation" + "type": "string" }, { "type": "null" } - ] + ], + "default": null + }, + "file_key_name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null + }, + "attached_node": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null } }, "additionalProperties": false, - "description": "SnapshotNode(database: Union[str, NoneType], schema: str, name: str, resource_type: dbt.node_types.NodeType, package_name: str, path: str, original_file_path: str, unique_id: str, fqn: List[str], alias: str, checksum: dbt.contracts.files.FileHash, config: dbt.contracts.graph.model_config.SnapshotConfig, _event_status: Dict[str, Any] = , tags: List[str] = , description: str = '', columns: Dict[str, dbt.contracts.graph.nodes.ColumnInfo] = , meta: Dict[str, Any] = , group: Union[str, NoneType] = None, docs: dbt.contracts.graph.unparsed.Docs = , patch_path: Union[str, NoneType] = None, build_path: Union[str, NoneType] = None, deferred: bool = False, unrendered_config: Dict[str, Any] = , created_at: float = , config_call_dict: Dict[str, Any] = , relation_name: Union[str, NoneType] = None, raw_code: str = '', language: str = 'sql', refs: List[dbt.contracts.graph.nodes.RefArgs] = , sources: List[List[str]] = , metrics: List[List[str]] = , depends_on: dbt.contracts.graph.nodes.DependsOn = , compiled_path: Union[str, NoneType] = None, compiled: bool = False, compiled_code: Union[str, NoneType] = None, extra_ctes_injected: bool = False, extra_ctes: List[dbt.contracts.graph.nodes.InjectedCTE] = , _pre_injected_sql: Union[str, NoneType] = None, contract: dbt.contracts.graph.nodes.Contract = , defer_relation: Union[dbt.contracts.graph.nodes.DeferRelation, NoneType] = None)" + "required": [ + "test_metadata", + "database", + "schema", + "name", + "resource_type", + "package_name", + "path", + "original_file_path", + "unique_id", + "fqn", + "alias", + "checksum" + ] }, "SnapshotConfig": { "type": "object", - "required": [], + "title": "SnapshotConfig", "properties": { + "_extra": { + "type": "object", + "propertyNames": { + "type": "string" + } + }, "enabled": { "type": "boolean", "default": true }, "alias": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "schema": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "database": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "tags": { - "oneOf": [ + "anyOf": [ { "type": "array", "items": { @@ -3255,85 +2740,94 @@ { "type": "string" } - ], - "default": [] + ] }, "meta": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "group": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "materialized": { "type": "string", "default": "snapshot" }, "incremental_strategy": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "persist_docs": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "post-hook": { "type": "array", "items": { - "$ref": "#/definitions/Hook" - }, - "default": [] + "$ref": "#/$defs/Hook" + } }, "pre-hook": { "type": "array", "items": { - "$ref": "#/definitions/Hook" - }, - "default": [] + "$ref": "#/$defs/Hook" + } }, "quoting": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "column_types": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "full_refresh": { - "oneOf": [ + "anyOf": [ { "type": "boolean" }, { "type": "null" } - ] + ], + "default": null }, "unique_key": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "on_schema_change": { - "oneOf": [ + "anyOf": [ { "type": "string" }, @@ -3344,80 +2838,76 @@ "default": "ignore" }, "on_configuration_change": { - "type": "string", "enum": [ "apply", "continue", "fail" - ], - "default": "apply" + ] }, "grants": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "packages": { "type": "array", "items": { "type": "string" - }, - "default": [] + } }, "docs": { - "$ref": "#/definitions/Docs", - "default": { - "show": true, - "node_color": null - } + "$ref": "#/$defs/Docs" }, "contract": { - "$ref": "#/definitions/ContractConfig", - "default": { - "enforced": false - } + "$ref": "#/$defs/ContractConfig" }, "strategy": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "target_schema": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "target_database": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "updated_at": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "check_cols": { - "oneOf": [ + "anyOf": [ { "type": "string" }, @@ -3430,29 +2920,18 @@ { "type": "null" } - ] + ], + "default": null } }, - "additionalProperties": true, - "description": "SnapshotConfig(_extra: Dict[str, Any] = , enabled: bool = True, alias: Union[str, NoneType] = None, schema: Union[str, NoneType] = None, database: Union[str, NoneType] = None, tags: Union[List[str], str] = , meta: Dict[str, Any] = , group: Union[str, NoneType] = None, materialized: str = 'snapshot', incremental_strategy: Union[str, NoneType] = None, persist_docs: Dict[str, Any] = , post_hook: List[dbt.contracts.graph.model_config.Hook] = , pre_hook: List[dbt.contracts.graph.model_config.Hook] = , quoting: Dict[str, Any] = , column_types: Dict[str, Any] = , full_refresh: Union[bool, NoneType] = None, unique_key: Union[str, NoneType] = None, on_schema_change: Union[str, NoneType] = 'ignore', on_configuration_change: dbt.contracts.graph.model_config.OnConfigurationChangeOption = , grants: Dict[str, Any] = , packages: List[str] = , docs: dbt.contracts.graph.unparsed.Docs = , contract: dbt.contracts.graph.model_config.ContractConfig = , strategy: Union[str, NoneType] = None, target_schema: Union[str, NoneType] = None, target_database: Union[str, NoneType] = None, updated_at: Union[str, NoneType] = None, check_cols: Union[str, List[str], NoneType] = None)" + "additionalProperties": true }, - "SeedNode": { + "SnapshotNode": { "type": "object", - "required": [ - "schema", - "name", - "resource_type", - "package_name", - "path", - "original_file_path", - "unique_id", - "fqn", - "alias", - "checksum" - ], + "title": "SnapshotNode", "properties": { "database": { - "oneOf": [ + "anyOf": [ { "type": "string" }, @@ -3468,10 +2947,7 @@ "type": "string" }, "resource_type": { - "type": "string", - "enum": [ - "seed" - ] + "const": "snapshot" }, "package_name": { "type": "string" @@ -3495,48 +2971,22 @@ "type": "string" }, "checksum": { - "$ref": "#/definitions/FileHash" + "$ref": "#/$defs/FileHash" }, "config": { - "$ref": "#/definitions/SeedConfig", - "default": { - "enabled": true, - "alias": null, - "schema": null, - "database": null, - "tags": [], - "meta": {}, - "group": null, - "materialized": "seed", - "incremental_strategy": null, - "persist_docs": {}, - "quoting": {}, - "column_types": {}, - "full_refresh": null, - "unique_key": null, - "on_schema_change": "ignore", - "on_configuration_change": "apply", - "grants": {}, - "packages": [], - "docs": { - "show": true, - "node_color": null - }, - "contract": { - "enforced": false - }, - "delimiter": ",", - "quote_columns": null, - "post-hook": [], - "pre-hook": [] + "$ref": "#/$defs/SnapshotConfig" + }, + "_event_status": { + "type": "object", + "propertyNames": { + "type": "string" } }, "tags": { "type": "array", "items": { "type": "string" - }, - "default": [] + } }, "description": { "type": "string", @@ -3545,50 +2995,53 @@ "columns": { "type": "object", "additionalProperties": { - "$ref": "#/definitions/ColumnInfo" + "$ref": "#/$defs/ColumnInfo" }, - "default": {} + "propertyNames": { + "type": "string" + } }, "meta": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "group": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "docs": { - "$ref": "#/definitions/Docs", - "default": { - "show": true, - "node_color": null - } + "$ref": "#/$defs/Docs" }, "patch_path": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "build_path": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "deferred": { "type": "boolean", @@ -3596,100 +3049,192 @@ }, "unrendered_config": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "created_at": { - "type": "number", - "default": 1691440799.318796 + "type": "number" }, "config_call_dict": { "type": "object", - "default": {} - }, + "propertyNames": { + "type": "string" + } + }, "relation_name": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "raw_code": { "type": "string", "default": "" }, - "root_path": { - "oneOf": [ + "language": { + "type": "string", + "default": "sql" + }, + "refs": { + "type": "array", + "items": { + "$ref": "#/$defs/RefArgs" + } + }, + "sources": { + "type": "array", + "items": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "metrics": { + "type": "array", + "items": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "depends_on": { + "$ref": "#/$defs/DependsOn" + }, + "compiled_path": { + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, - "depends_on": { - "$ref": "#/definitions/MacroDependsOn", - "default": { - "macros": [] + "compiled": { + "type": "boolean", + "default": false + }, + "compiled_code": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null + }, + "extra_ctes_injected": { + "type": "boolean", + "default": false + }, + "extra_ctes": { + "type": "array", + "items": { + "$ref": "#/$defs/InjectedCTE" } }, + "_pre_injected_sql": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null + }, + "contract": { + "$ref": "#/$defs/Contract" + }, "defer_relation": { - "oneOf": [ + "anyOf": [ { - "$ref": "#/definitions/DeferRelation" + "$ref": "#/$defs/DeferRelation" }, { "type": "null" } - ] + ], + "default": null } }, "additionalProperties": false, - "description": "SeedNode(database: Union[str, NoneType], schema: str, name: str, resource_type: dbt.node_types.NodeType, package_name: str, path: str, original_file_path: str, unique_id: str, fqn: List[str], alias: str, checksum: dbt.contracts.files.FileHash, config: dbt.contracts.graph.model_config.SeedConfig = , _event_status: Dict[str, Any] = , tags: List[str] = , description: str = '', columns: Dict[str, dbt.contracts.graph.nodes.ColumnInfo] = , meta: Dict[str, Any] = , group: Union[str, NoneType] = None, docs: dbt.contracts.graph.unparsed.Docs = , patch_path: Union[str, NoneType] = None, build_path: Union[str, NoneType] = None, deferred: bool = False, unrendered_config: Dict[str, Any] = , created_at: float = , config_call_dict: Dict[str, Any] = , relation_name: Union[str, NoneType] = None, raw_code: str = '', root_path: Union[str, NoneType] = None, depends_on: dbt.contracts.graph.nodes.MacroDependsOn = , defer_relation: Union[dbt.contracts.graph.nodes.DeferRelation, NoneType] = None)" + "required": [ + "database", + "schema", + "name", + "resource_type", + "package_name", + "path", + "original_file_path", + "unique_id", + "fqn", + "alias", + "checksum", + "config" + ] }, "SeedConfig": { "type": "object", - "required": [], + "title": "SeedConfig", "properties": { + "_extra": { + "type": "object", + "propertyNames": { + "type": "string" + } + }, "enabled": { "type": "boolean", "default": true }, "alias": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "schema": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "database": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "tags": { - "oneOf": [ + "anyOf": [ { "type": "array", "items": { @@ -3699,75 +3244,83 @@ { "type": "string" } - ], - "default": [] + ] }, "meta": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "group": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "materialized": { "type": "string", "default": "seed" }, "incremental_strategy": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "persist_docs": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "post-hook": { "type": "array", "items": { - "$ref": "#/definitions/Hook" - }, - "default": [] + "$ref": "#/$defs/Hook" + } }, "pre-hook": { "type": "array", "items": { - "$ref": "#/definitions/Hook" - }, - "default": [] + "$ref": "#/$defs/Hook" + } }, "quoting": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "column_types": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "full_refresh": { - "oneOf": [ + "anyOf": [ { "type": "boolean" }, { "type": "null" } - ] + ], + "default": null }, "unique_key": { - "oneOf": [ + "anyOf": [ { "type": "string" }, @@ -3780,10 +3333,11 @@ { "type": "null" } - ] + ], + "default": null }, "on_schema_change": { - "oneOf": [ + "anyOf": [ { "type": "string" }, @@ -3794,90 +3348,67 @@ "default": "ignore" }, "on_configuration_change": { - "type": "string", "enum": [ "apply", "continue", "fail" - ], - "default": "apply" + ] }, "grants": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "packages": { "type": "array", "items": { "type": "string" - }, - "default": [] + } }, "docs": { - "$ref": "#/definitions/Docs", - "default": { - "show": true, - "node_color": null - } + "$ref": "#/$defs/Docs" }, "contract": { - "$ref": "#/definitions/ContractConfig", - "default": { - "enforced": false - } + "$ref": "#/$defs/ContractConfig" }, "delimiter": { "type": "string", "default": "," }, "quote_columns": { - "oneOf": [ + "anyOf": [ { "type": "boolean" }, { "type": "null" } - ] + ], + "default": null } }, - "additionalProperties": true, - "description": "SeedConfig(_extra: Dict[str, Any] = , enabled: bool = True, alias: Union[str, NoneType] = None, schema: Union[str, NoneType] = None, database: Union[str, NoneType] = None, tags: Union[List[str], str] = , meta: Dict[str, Any] = , group: Union[str, NoneType] = None, materialized: str = 'seed', incremental_strategy: Union[str, NoneType] = None, persist_docs: Dict[str, Any] = , post_hook: List[dbt.contracts.graph.model_config.Hook] = , pre_hook: List[dbt.contracts.graph.model_config.Hook] = , quoting: Dict[str, Any] = , column_types: Dict[str, Any] = , full_refresh: Union[bool, NoneType] = None, unique_key: Union[str, List[str], NoneType] = None, on_schema_change: Union[str, NoneType] = 'ignore', on_configuration_change: dbt.contracts.graph.model_config.OnConfigurationChangeOption = , grants: Dict[str, Any] = , packages: List[str] = , docs: dbt.contracts.graph.unparsed.Docs = , contract: dbt.contracts.graph.model_config.ContractConfig = , delimiter: str = ',', quote_columns: Union[bool, NoneType] = None)" + "additionalProperties": true }, "MacroDependsOn": { "type": "object", - "required": [], + "title": "MacroDependsOn", "properties": { "macros": { "type": "array", "items": { "type": "string" - }, - "default": [] + } } }, - "additionalProperties": false, - "description": "Used only in the Macro class" + "additionalProperties": false }, - "SourceDefinition": { + "SeedNode": { "type": "object", - "required": [ - "schema", - "name", - "resource_type", - "package_name", - "path", - "original_file_path", - "unique_id", - "fqn", - "source_name", - "source_description", - "loader", - "identifier" - ], + "title": "SeedNode", "properties": { "database": { - "oneOf": [ + "anyOf": [ { "type": "string" }, @@ -3893,10 +3424,7 @@ "type": "string" }, "resource_type": { - "type": "string", - "enum": [ - "source" - ] + "const": "seed" }, "package_name": { "type": "string" @@ -3916,294 +3444,366 @@ "type": "string" } }, - "source_name": { + "alias": { "type": "string" }, - "source_description": { - "type": "string" + "checksum": { + "$ref": "#/$defs/FileHash" }, - "loader": { - "type": "string" + "config": { + "$ref": "#/$defs/SeedConfig" }, - "identifier": { - "type": "string" + "_event_status": { + "type": "object", + "propertyNames": { + "type": "string" + } }, - "quoting": { - "$ref": "#/definitions/Quoting", - "default": { - "database": null, - "schema": null, - "identifier": null, - "column": null + "tags": { + "type": "array", + "items": { + "type": "string" } }, - "loaded_at_field": { - "oneOf": [ + "description": { + "type": "string", + "default": "" + }, + "columns": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/ColumnInfo" + }, + "propertyNames": { + "type": "string" + } + }, + "meta": { + "type": "object", + "propertyNames": { + "type": "string" + } + }, + "group": { + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, - "freshness": { - "oneOf": [ + "docs": { + "$ref": "#/$defs/Docs" + }, + "patch_path": { + "anyOf": [ { - "$ref": "#/definitions/FreshnessThreshold" + "type": "string" }, { "type": "null" } - ] + ], + "default": null }, - "external": { - "oneOf": [ + "build_path": { + "anyOf": [ { - "$ref": "#/definitions/ExternalTable" + "type": "string" }, { "type": "null" } - ] + ], + "default": null }, - "description": { - "type": "string", - "default": "" + "deferred": { + "type": "boolean", + "default": false }, - "columns": { + "unrendered_config": { "type": "object", - "additionalProperties": { - "$ref": "#/definitions/ColumnInfo" - }, - "default": {} + "propertyNames": { + "type": "string" + } }, - "meta": { - "type": "object", - "default": {} + "created_at": { + "type": "number" }, - "source_meta": { + "config_call_dict": { "type": "object", - "default": {} - }, - "tags": { - "type": "array", - "items": { + "propertyNames": { "type": "string" - }, - "default": [] - }, - "config": { - "$ref": "#/definitions/SourceConfig", - "default": { - "enabled": true } }, - "patch_path": { - "oneOf": [ + "relation_name": { + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, - "unrendered_config": { - "type": "object", - "default": {} + "raw_code": { + "type": "string", + "default": "" }, - "relation_name": { - "oneOf": [ + "root_path": { + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, - "created_at": { - "type": "number", - "default": 1691440799.32196 + "depends_on": { + "$ref": "#/$defs/MacroDependsOn" + }, + "defer_relation": { + "anyOf": [ + { + "$ref": "#/$defs/DeferRelation" + }, + { + "type": "null" + } + ], + "default": null } }, "additionalProperties": false, - "description": "SourceDefinition(database: Union[str, NoneType], schema: str, name: str, resource_type: dbt.node_types.NodeType, package_name: str, path: str, original_file_path: str, unique_id: str, fqn: List[str], source_name: str, source_description: str, loader: str, identifier: str, _event_status: Dict[str, Any] = , quoting: dbt.contracts.graph.unparsed.Quoting = , loaded_at_field: Union[str, NoneType] = None, freshness: Union[dbt.contracts.graph.unparsed.FreshnessThreshold, NoneType] = None, external: Union[dbt.contracts.graph.unparsed.ExternalTable, NoneType] = None, description: str = '', columns: Dict[str, dbt.contracts.graph.nodes.ColumnInfo] = , meta: Dict[str, Any] = , source_meta: Dict[str, Any] = , tags: List[str] = , config: dbt.contracts.graph.model_config.SourceConfig = , patch_path: Union[str, NoneType] = None, unrendered_config: Dict[str, Any] = , relation_name: Union[str, NoneType] = None, created_at: float = )" + "required": [ + "database", + "schema", + "name", + "resource_type", + "package_name", + "path", + "original_file_path", + "unique_id", + "fqn", + "alias", + "checksum" + ] }, "Quoting": { "type": "object", - "required": [], + "title": "Quoting", "properties": { "database": { - "oneOf": [ + "anyOf": [ { "type": "boolean" }, { "type": "null" } - ] + ], + "default": null }, "schema": { - "oneOf": [ + "anyOf": [ { "type": "boolean" }, { "type": "null" } - ] + ], + "default": null }, "identifier": { - "oneOf": [ + "anyOf": [ { "type": "boolean" }, { "type": "null" } - ] + ], + "default": null }, "column": { - "oneOf": [ + "anyOf": [ { "type": "boolean" }, { "type": "null" } - ] + ], + "default": null } }, - "additionalProperties": false, - "description": "Quoting(database: Union[bool, NoneType] = None, schema: Union[bool, NoneType] = None, identifier: Union[bool, NoneType] = None, column: Union[bool, NoneType] = None)" + "additionalProperties": false }, - "FreshnessThreshold": { + "Time": { "type": "object", - "required": [], + "title": "Time", "properties": { - "warn_after": { - "oneOf": [ + "count": { + "anyOf": [ { - "$ref": "#/definitions/Time" + "type": "integer" }, { "type": "null" } ], - "default": { - "count": null, - "period": null - } + "default": null }, - "error_after": { - "oneOf": [ + "period": { + "anyOf": [ { - "$ref": "#/definitions/Time" + "enum": [ + "minute", + "hour", + "day" + ] }, { "type": "null" } ], - "default": { - "count": null, - "period": null - } - }, - "filter": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "default": null } }, - "additionalProperties": false, - "description": "FreshnessThreshold(warn_after: Union[dbt.contracts.graph.unparsed.Time, NoneType] = , error_after: Union[dbt.contracts.graph.unparsed.Time, NoneType] = , filter: Union[str, NoneType] = None)" + "additionalProperties": false }, - "Time": { + "FreshnessThreshold": { "type": "object", - "required": [], + "title": "FreshnessThreshold", "properties": { - "count": { - "oneOf": [ + "warn_after": { + "anyOf": [ { - "type": "integer" + "$ref": "#/$defs/Time" }, { "type": "null" } ] }, - "period": { - "oneOf": [ + "error_after": { + "anyOf": [ { - "type": "string", - "enum": [ - "minute", - "hour", - "day" - ] + "$ref": "#/$defs/Time" }, { "type": "null" } ] + }, + "filter": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null } }, - "additionalProperties": false, - "description": "Time(count: Union[int, NoneType] = None, period: Union[dbt.contracts.graph.unparsed.TimePeriod, NoneType] = None)" + "additionalProperties": false + }, + "ExternalPartition": { + "type": "object", + "title": "ExternalPartition", + "properties": { + "_extra": { + "type": "object", + "propertyNames": { + "type": "string" + } + }, + "name": { + "type": "string", + "default": "" + }, + "description": { + "type": "string", + "default": "" + }, + "data_type": { + "type": "string", + "default": "" + }, + "meta": { + "type": "object", + "propertyNames": { + "type": "string" + } + } + }, + "additionalProperties": true }, "ExternalTable": { "type": "object", - "required": [], + "title": "ExternalTable", "properties": { + "_extra": { + "type": "object", + "propertyNames": { + "type": "string" + } + }, "location": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "file_format": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "row_format": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "tbl_properties": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "partitions": { - "oneOf": [ + "anyOf": [ { "type": "array", "items": { @@ -4213,74 +3813,57 @@ { "type": "array", "items": { - "$ref": "#/definitions/ExternalPartition" + "$ref": "#/$defs/ExternalPartition" } }, { "type": "null" } - ] - } - }, - "additionalProperties": true, - "description": "ExternalTable(_extra: Dict[str, Any] = , location: Union[str, NoneType] = None, file_format: Union[str, NoneType] = None, row_format: Union[str, NoneType] = None, tbl_properties: Union[str, NoneType] = None, partitions: Union[List[str], List[dbt.contracts.graph.unparsed.ExternalPartition], NoneType] = None)" - }, - "ExternalPartition": { - "type": "object", - "required": [], - "properties": { - "name": { - "type": "string", - "default": "" - }, - "description": { - "type": "string", - "default": "" - }, - "data_type": { - "type": "string", - "default": "" - }, - "meta": { - "type": "object", - "default": {} + ], + "default": null } }, - "additionalProperties": true, - "description": "ExternalPartition(_extra: Dict[str, Any] = , name: str = '', description: str = '', data_type: str = '', meta: Dict[str, Any] = )" + "additionalProperties": true }, "SourceConfig": { "type": "object", - "required": [], + "title": "SourceConfig", "properties": { + "_extra": { + "type": "object", + "propertyNames": { + "type": "string" + } + }, "enabled": { "type": "boolean", "default": true } }, - "additionalProperties": true, - "description": "SourceConfig(_extra: Dict[str, Any] = , enabled: bool = True)" + "additionalProperties": true }, - "Macro": { + "SourceDefinition": { "type": "object", - "required": [ - "name", - "resource_type", - "package_name", - "path", - "original_file_path", - "unique_id", - "macro_sql" - ], + "title": "SourceDefinition", "properties": { + "database": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "schema": { + "type": "string" + }, "name": { "type": "string" }, "resource_type": { - "type": "string", - "enum": [ - "macro" - ] + "const": "source" }, "package_name": { "type": "string" @@ -4294,142 +3877,136 @@ "unique_id": { "type": "string" }, - "macro_sql": { + "fqn": { + "type": "array", + "items": { + "type": "string" + } + }, + "source_name": { "type": "string" }, - "depends_on": { - "$ref": "#/definitions/MacroDependsOn", - "default": { - "macros": [] - } + "source_description": { + "type": "string" }, - "description": { - "type": "string", - "default": "" + "loader": { + "type": "string" }, - "meta": { - "type": "object", - "default": {} + "identifier": { + "type": "string" }, - "docs": { - "$ref": "#/definitions/Docs", - "default": { - "show": true, - "node_color": null + "_event_status": { + "type": "object", + "propertyNames": { + "type": "string" } }, - "patch_path": { - "oneOf": [ + "quoting": { + "$ref": "#/$defs/Quoting" + }, + "loaded_at_field": { + "anyOf": [ { "type": "string" }, { "type": "null" } - ] - }, - "arguments": { - "type": "array", - "items": { - "$ref": "#/definitions/MacroArgument" - }, - "default": [] - }, - "created_at": { - "type": "number", - "default": 1691440799.3226922 + ], + "default": null }, - "supported_languages": { - "oneOf": [ + "freshness": { + "anyOf": [ { - "type": "array", - "items": { - "type": "string", - "enum": [ - "python", - "sql" - ] - } + "$ref": "#/$defs/FreshnessThreshold" }, { "type": "null" } - ] - } - }, - "additionalProperties": false, - "description": "Macro(name: str, resource_type: dbt.node_types.NodeType, package_name: str, path: str, original_file_path: str, unique_id: str, macro_sql: str, depends_on: dbt.contracts.graph.nodes.MacroDependsOn = , description: str = '', meta: Dict[str, Any] = , docs: dbt.contracts.graph.unparsed.Docs = , patch_path: Union[str, NoneType] = None, arguments: List[dbt.contracts.graph.unparsed.MacroArgument] = , created_at: float = , supported_languages: Union[List[dbt.node_types.ModelLanguage], NoneType] = None)" - }, - "MacroArgument": { - "type": "object", - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string" + ], + "default": null }, - "type": { - "oneOf": [ + "external": { + "anyOf": [ { - "type": "string" + "$ref": "#/$defs/ExternalTable" }, { "type": "null" } - ] + ], + "default": null }, "description": { "type": "string", "default": "" - } - }, - "additionalProperties": false, - "description": "MacroArgument(name: str, type: Union[str, NoneType] = None, description: str = '')" - }, - "Documentation": { - "type": "object", - "required": [ - "name", - "resource_type", - "package_name", - "path", - "original_file_path", - "unique_id", - "block_contents" - ], - "properties": { - "name": { - "type": "string" - }, - "resource_type": { - "type": "string", - "enum": [ - "doc" - ] }, - "package_name": { - "type": "string" + "columns": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/ColumnInfo" + }, + "propertyNames": { + "type": "string" + } }, - "path": { - "type": "string" + "meta": { + "type": "object", + "propertyNames": { + "type": "string" + } }, - "original_file_path": { - "type": "string" + "source_meta": { + "type": "object", + "propertyNames": { + "type": "string" + } }, - "unique_id": { - "type": "string" + "tags": { + "type": "array", + "items": { + "type": "string" + } }, - "block_contents": { - "type": "string" + "config": { + "$ref": "#/$defs/SourceConfig" + }, + "patch_path": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null + }, + "unrendered_config": { + "type": "object", + "propertyNames": { + "type": "string" + } + }, + "relation_name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null + }, + "created_at": { + "type": "number" } }, "additionalProperties": false, - "description": "Documentation(name: str, resource_type: dbt.node_types.NodeType, package_name: str, path: str, original_file_path: str, unique_id: str, block_contents: str)" - }, - "Exposure": { - "type": "object", "required": [ + "database", + "schema", "name", "resource_type", "package_name", @@ -4437,18 +4014,49 @@ "original_file_path", "unique_id", "fqn", - "type", - "owner" - ], + "source_name", + "source_description", + "loader", + "identifier" + ] + }, + "MacroArgument": { + "type": "object", + "title": "MacroArgument", "properties": { "name": { "type": "string" }, - "resource_type": { + "type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null + }, + "description": { "type": "string", - "enum": [ - "exposure" - ] + "default": "" + } + }, + "additionalProperties": false, + "required": [ + "name" + ] + }, + "Macro": { + "type": "object", + "title": "Macro", + "properties": { + "name": { + "type": "string" + }, + "resource_type": { + "const": "macro" }, "package_name": { "type": "string" @@ -4462,191 +4070,172 @@ "unique_id": { "type": "string" }, - "fqn": { - "type": "array", - "items": { - "type": "string" - } - }, - "type": { - "type": "string", - "enum": [ - "dashboard", - "notebook", - "analysis", - "ml", - "application" - ] + "macro_sql": { + "type": "string" }, - "owner": { - "$ref": "#/definitions/Owner" + "depends_on": { + "$ref": "#/$defs/MacroDependsOn" }, "description": { "type": "string", "default": "" }, - "label": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "meta": { + "type": "object", + "propertyNames": { + "type": "string" + } }, - "maturity": { - "oneOf": [ + "docs": { + "$ref": "#/$defs/Docs" + }, + "patch_path": { + "anyOf": [ { - "type": "string", - "enum": [ - "low", - "medium", - "high" - ] + "type": "string" }, { "type": "null" } - ] - }, - "meta": { - "type": "object", - "default": {} + ], + "default": null }, - "tags": { + "arguments": { "type": "array", "items": { - "type": "string" - }, - "default": [] - }, - "config": { - "$ref": "#/definitions/ExposureConfig", - "default": { - "enabled": true + "$ref": "#/$defs/MacroArgument" } }, - "unrendered_config": { - "type": "object", - "default": {} + "created_at": { + "type": "number" }, - "url": { - "oneOf": [ + "supported_languages": { + "anyOf": [ { - "type": "string" + "type": "array", + "items": { + "enum": [ + "python", + "sql" + ] + } }, { "type": "null" } - ] + ], + "default": null + } + }, + "additionalProperties": false, + "required": [ + "name", + "resource_type", + "package_name", + "path", + "original_file_path", + "unique_id", + "macro_sql" + ] + }, + "Documentation": { + "type": "object", + "title": "Documentation", + "properties": { + "name": { + "type": "string" }, - "depends_on": { - "$ref": "#/definitions/DependsOn", - "default": { - "macros": [], - "nodes": [] - } + "resource_type": { + "const": "doc" }, - "refs": { - "type": "array", - "items": { - "$ref": "#/definitions/RefArgs" - }, - "default": [] + "package_name": { + "type": "string" }, - "sources": { - "type": "array", - "items": { - "type": "array", - "items": { - "type": "string" - } - }, - "default": [] + "path": { + "type": "string" }, - "metrics": { - "type": "array", - "items": { - "type": "array", - "items": { - "type": "string" - } - }, - "default": [] + "original_file_path": { + "type": "string" }, - "created_at": { - "type": "number", - "default": 1691440799.324348 + "unique_id": { + "type": "string" + }, + "block_contents": { + "type": "string" } }, "additionalProperties": false, - "description": "Exposure(name: str, resource_type: dbt.node_types.NodeType, package_name: str, path: str, original_file_path: str, unique_id: str, fqn: List[str], type: dbt.contracts.graph.unparsed.ExposureType, owner: dbt.contracts.graph.unparsed.Owner, description: str = '', label: Union[str, NoneType] = None, maturity: Union[dbt.contracts.graph.unparsed.MaturityType, NoneType] = None, meta: Dict[str, Any] = , tags: List[str] = , config: dbt.contracts.graph.model_config.ExposureConfig = , unrendered_config: Dict[str, Any] = , url: Union[str, NoneType] = None, depends_on: dbt.contracts.graph.nodes.DependsOn = , refs: List[dbt.contracts.graph.nodes.RefArgs] = , sources: List[List[str]] = , metrics: List[List[str]] = , created_at: float = )" + "required": [ + "name", + "resource_type", + "package_name", + "path", + "original_file_path", + "unique_id", + "block_contents" + ] }, "Owner": { "type": "object", - "required": [], + "title": "Owner", "properties": { + "_extra": { + "type": "object", + "propertyNames": { + "type": "string" + } + }, "email": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "name": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null } }, - "additionalProperties": true, - "description": "Owner(_extra: Dict[str, Any] = , email: Union[str, NoneType] = None, name: Union[str, NoneType] = None)" + "additionalProperties": true }, "ExposureConfig": { "type": "object", - "required": [], + "title": "ExposureConfig", "properties": { + "_extra": { + "type": "object", + "propertyNames": { + "type": "string" + } + }, "enabled": { "type": "boolean", "default": true } }, - "additionalProperties": true, - "description": "ExposureConfig(_extra: Dict[str, Any] = , enabled: bool = True)" + "additionalProperties": true }, - "Metric": { + "Exposure": { "type": "object", - "required": [ - "name", - "resource_type", - "package_name", - "path", - "original_file_path", - "unique_id", - "fqn", - "description", - "label", - "type", - "type_params" - ], + "title": "Exposure", "properties": { "name": { "type": "string" }, "resource_type": { - "type": "string", - "enum": [ - "metric" - ] + "const": "exposure" }, "package_name": { "type": "string" @@ -4666,183 +4255,238 @@ "type": "string" } }, - "description": { - "type": "string" - }, - "label": { - "type": "string" - }, "type": { - "type": "string", "enum": [ - "simple", - "ratio", - "cumulative", - "derived" + "dashboard", + "notebook", + "analysis", + "ml", + "application" ] }, - "type_params": { - "$ref": "#/definitions/MetricTypeParams" + "owner": { + "$ref": "#/$defs/Owner" }, - "filter": { - "oneOf": [ + "description": { + "type": "string", + "default": "" + }, + "label": { + "anyOf": [ { - "$ref": "#/definitions/WhereFilter" + "type": "string" }, { "type": "null" } - ] + ], + "default": null }, - "metadata": { - "oneOf": [ + "maturity": { + "anyOf": [ { - "$ref": "#/definitions/SourceFileMetadata" + "enum": [ + "low", + "medium", + "high" + ] }, { "type": "null" } - ] + ], + "default": null }, "meta": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, "tags": { "type": "array", "items": { "type": "string" - }, - "default": [] + } }, "config": { - "$ref": "#/definitions/MetricConfig", - "default": { - "enabled": true, - "group": null - } + "$ref": "#/$defs/ExposureConfig" }, "unrendered_config": { "type": "object", - "default": {} + "propertyNames": { + "type": "string" + } }, - "sources": { - "type": "array", - "items": { - "type": "array", - "items": { + "url": { + "anyOf": [ + { "type": "string" + }, + { + "type": "null" } - }, - "default": [] + ], + "default": null }, "depends_on": { - "$ref": "#/definitions/DependsOn", - "default": { - "macros": [], - "nodes": [] - } + "$ref": "#/$defs/DependsOn" }, "refs": { "type": "array", "items": { - "$ref": "#/definitions/RefArgs" - }, - "default": [] + "$ref": "#/$defs/RefArgs" + } }, - "metrics": { + "sources": { "type": "array", "items": { "type": "array", "items": { "type": "string" } - }, - "default": [] - }, - "created_at": { - "type": "number", - "default": 1691440799.327093 + } }, - "group": { - "oneOf": [ - { + "metrics": { + "type": "array", + "items": { + "type": "array", + "items": { "type": "string" - }, - { - "type": "null" } - ] + } + }, + "created_at": { + "type": "number" + } + }, + "additionalProperties": false, + "required": [ + "name", + "resource_type", + "package_name", + "path", + "original_file_path", + "unique_id", + "fqn", + "type", + "owner" + ] + }, + "WhereFilter": { + "type": "object", + "title": "WhereFilter", + "properties": { + "where_sql_template": { + "type": "string" } }, "additionalProperties": false, - "description": "Metric(name: str, resource_type: dbt.node_types.NodeType, package_name: str, path: str, original_file_path: str, unique_id: str, fqn: List[str], description: str, label: str, type: dbt_semantic_interfaces.type_enums.metric_type.MetricType, type_params: dbt.contracts.graph.nodes.MetricTypeParams, filter: Union[dbt.contracts.graph.nodes.WhereFilter, NoneType] = None, metadata: Union[dbt.contracts.graph.semantic_models.SourceFileMetadata, NoneType] = None, meta: Dict[str, Any] = , tags: List[str] = , config: dbt.contracts.graph.model_config.MetricConfig = , unrendered_config: Dict[str, Any] = , sources: List[List[str]] = , depends_on: dbt.contracts.graph.nodes.DependsOn = , refs: List[dbt.contracts.graph.nodes.RefArgs] = , metrics: List[List[str]] = , created_at: float = , group: Union[str, NoneType] = None)" + "required": [ + "where_sql_template" + ] }, - "MetricTypeParams": { + "MetricInputMeasure": { "type": "object", - "required": [], + "title": "MetricInputMeasure", "properties": { - "measure": { - "oneOf": [ + "name": { + "type": "string" + }, + "filter": { + "anyOf": [ { - "$ref": "#/definitions/MetricInputMeasure" + "$ref": "#/$defs/WhereFilter" }, { "type": "null" } - ] - }, - "input_measures": { - "type": "array", - "items": { - "$ref": "#/definitions/MetricInputMeasure" - }, - "default": [] + ], + "default": null }, - "numerator": { - "oneOf": [ + "alias": { + "anyOf": [ { - "$ref": "#/definitions/MetricInput" + "type": "string" }, { "type": "null" } + ], + "default": null + } + }, + "additionalProperties": false, + "required": [ + "name" + ] + }, + "MetricTimeWindow": { + "type": "object", + "title": "MetricTimeWindow", + "properties": { + "count": { + "type": "integer" + }, + "granularity": { + "enum": [ + "day", + "week", + "month", + "quarter", + "year" ] + } + }, + "additionalProperties": false, + "required": [ + "count", + "granularity" + ] + }, + "MetricInput": { + "type": "object", + "title": "MetricInput", + "properties": { + "name": { + "type": "string" }, - "denominator": { - "oneOf": [ + "filter": { + "anyOf": [ { - "$ref": "#/definitions/MetricInput" + "$ref": "#/$defs/WhereFilter" }, { "type": "null" } - ] + ], + "default": null }, - "expr": { - "oneOf": [ + "alias": { + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, - "window": { - "oneOf": [ + "offset_window": { + "anyOf": [ { - "$ref": "#/definitions/MetricTimeWindow" + "$ref": "#/$defs/MetricTimeWindow" }, { "type": "null" } - ] + ], + "default": null }, - "grain_to_date": { - "oneOf": [ + "offset_to_grain": { + "anyOf": [ { - "type": "string", "enum": [ "day", "week", @@ -4854,114 +4498,83 @@ { "type": "null" } - ] - }, - "metrics": { - "oneOf": [ - { - "type": "array", - "items": { - "$ref": "#/definitions/MetricInput" - } - }, - { - "type": "null" - } - ] + ], + "default": null } }, "additionalProperties": false, - "description": "MetricTypeParams(measure: Union[dbt.contracts.graph.nodes.MetricInputMeasure, NoneType] = None, input_measures: List[dbt.contracts.graph.nodes.MetricInputMeasure] = , numerator: Union[dbt.contracts.graph.nodes.MetricInput, NoneType] = None, denominator: Union[dbt.contracts.graph.nodes.MetricInput, NoneType] = None, expr: Union[str, NoneType] = None, window: Union[dbt.contracts.graph.nodes.MetricTimeWindow, NoneType] = None, grain_to_date: Union[dbt_semantic_interfaces.type_enums.time_granularity.TimeGranularity, NoneType] = None, metrics: Union[List[dbt.contracts.graph.nodes.MetricInput], NoneType] = None)" - }, - "MetricInputMeasure": { - "type": "object", "required": [ "name" - ], + ] + }, + "MetricTypeParams": { + "type": "object", + "title": "MetricTypeParams", "properties": { - "name": { - "type": "string" - }, - "filter": { - "oneOf": [ + "measure": { + "anyOf": [ { - "$ref": "#/definitions/WhereFilter" + "$ref": "#/$defs/MetricInputMeasure" }, { "type": "null" } - ] + ], + "default": null }, - "alias": { - "oneOf": [ + "input_measures": { + "type": "array", + "items": { + "$ref": "#/$defs/MetricInputMeasure" + } + }, + "numerator": { + "anyOf": [ { - "type": "string" + "$ref": "#/$defs/MetricInput" }, { "type": "null" } - ] - } - }, - "additionalProperties": false, - "description": "MetricInputMeasure(name: str, filter: Union[dbt.contracts.graph.nodes.WhereFilter, NoneType] = None, alias: Union[str, NoneType] = None)" - }, - "WhereFilter": { - "type": "object", - "required": [ - "where_sql_template" - ], - "properties": { - "where_sql_template": { - "type": "string" - } - }, - "additionalProperties": false, - "description": "WhereFilter(where_sql_template: str)" - }, - "MetricInput": { - "type": "object", - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string" + ], + "default": null }, - "filter": { - "oneOf": [ + "denominator": { + "anyOf": [ { - "$ref": "#/definitions/WhereFilter" + "$ref": "#/$defs/MetricInput" }, { "type": "null" } - ] + ], + "default": null }, - "alias": { - "oneOf": [ + "expr": { + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, - "offset_window": { - "oneOf": [ + "window": { + "anyOf": [ { - "$ref": "#/definitions/MetricTimeWindow" + "$ref": "#/$defs/MetricTimeWindow" }, { "type": "null" } - ] + ], + "default": null }, - "offset_to_grain": { - "oneOf": [ + "grain_to_date": { + "anyOf": [ { - "type": "string", "enum": [ "day", "week", @@ -4973,175 +4586,105 @@ { "type": "null" } - ] + ], + "default": null + }, + "metrics": { + "anyOf": [ + { + "type": "array", + "items": { + "$ref": "#/$defs/MetricInput" + } + }, + { + "type": "null" + } + ], + "default": null } }, - "additionalProperties": false, - "description": "MetricInput(name: str, filter: Union[dbt.contracts.graph.nodes.WhereFilter, NoneType] = None, alias: Union[str, NoneType] = None, offset_window: Union[dbt.contracts.graph.nodes.MetricTimeWindow, NoneType] = None, offset_to_grain: Union[dbt_semantic_interfaces.type_enums.time_granularity.TimeGranularity, NoneType] = None)" + "additionalProperties": false }, - "MetricTimeWindow": { + "FileSlice": { "type": "object", - "required": [ - "count", - "granularity" - ], + "title": "FileSlice", "properties": { - "count": { + "filename": { + "type": "string" + }, + "content": { + "type": "string" + }, + "start_line_number": { "type": "integer" }, - "granularity": { - "type": "string", - "enum": [ - "day", - "week", - "month", - "quarter", - "year" - ] + "end_line_number": { + "type": "integer" } }, "additionalProperties": false, - "description": "MetricTimeWindow(count: int, granularity: dbt_semantic_interfaces.type_enums.time_granularity.TimeGranularity)" + "required": [ + "filename", + "content", + "start_line_number", + "end_line_number" + ] }, "SourceFileMetadata": { "type": "object", - "required": [ - "repo_file_path", - "file_slice" - ], + "title": "SourceFileMetadata", "properties": { "repo_file_path": { "type": "string" }, "file_slice": { - "$ref": "#/definitions/FileSlice" + "$ref": "#/$defs/FileSlice" } }, "additionalProperties": false, - "description": "Provides file context about what something was created from.\n\n Implementation of the dbt-semantic-interfaces `Metadata` protocol\n " - }, - "FileSlice": { - "type": "object", "required": [ - "filename", - "content", - "start_line_number", - "end_line_number" - ], - "properties": { - "filename": { - "type": "string" - }, - "content": { - "type": "string" - }, - "start_line_number": { - "type": "integer" - }, - "end_line_number": { - "type": "integer" - } - }, - "additionalProperties": false, - "description": "Provides file slice level context about what something was created from.\n\n Implementation of the dbt-semantic-interfaces `FileSlice` protocol\n " + "repo_file_path", + "file_slice" + ] }, "MetricConfig": { "type": "object", - "required": [], + "title": "MetricConfig", "properties": { + "_extra": { + "type": "object", + "propertyNames": { + "type": "string" + } + }, "enabled": { "type": "boolean", "default": true }, "group": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] - } - }, - "additionalProperties": true, - "description": "MetricConfig(_extra: Dict[str, Any] = , enabled: bool = True, group: Union[str, NoneType] = None)" - }, - "Group": { - "type": "object", - "required": [ - "name", - "resource_type", - "package_name", - "path", - "original_file_path", - "unique_id", - "owner" - ], - "properties": { - "name": { - "type": "string" - }, - "resource_type": { - "type": "string", - "enum": [ - "group" - ] - }, - "package_name": { - "type": "string" - }, - "path": { - "type": "string" - }, - "original_file_path": { - "type": "string" - }, - "unique_id": { - "type": "string" - }, - "owner": { - "$ref": "#/definitions/Owner" + ], + "default": null } }, - "additionalProperties": false, - "description": "Group(name: str, resource_type: dbt.node_types.NodeType, package_name: str, path: str, original_file_path: str, unique_id: str, owner: dbt.contracts.graph.unparsed.Owner)" + "additionalProperties": true }, - "SemanticModel": { + "Metric": { "type": "object", - "required": [ - "name", - "resource_type", - "package_name", - "path", - "original_file_path", - "unique_id", - "fqn", - "model" - ], + "title": "Metric", "properties": { "name": { "type": "string" }, "resource_type": { - "type": "string", - "enum": [ - "model", - "analysis", - "test", - "snapshot", - "operation", - "seed", - "rpc", - "sql_operation", - "doc", - "source", - "macro", - "exposure", - "metric", - "group", - "semantic_model" - ] + "const": "metric" }, "package_name": { "type": "string" @@ -5161,114 +4704,163 @@ "type": "string" } }, - "model": { + "description": { "type": "string" }, - "node_relation": { - "oneOf": [ - { - "$ref": "#/definitions/NodeRelation" - }, - { - "type": "null" - } + "label": { + "type": "string" + }, + "type": { + "enum": [ + "simple", + "ratio", + "cumulative", + "derived" ] }, - "description": { - "oneOf": [ + "type_params": { + "$ref": "#/$defs/MetricTypeParams" + }, + "filter": { + "anyOf": [ { - "type": "string" + "$ref": "#/$defs/WhereFilter" }, { "type": "null" } - ] + ], + "default": null }, - "defaults": { - "oneOf": [ + "metadata": { + "anyOf": [ { - "$ref": "#/definitions/Defaults" + "$ref": "#/$defs/SourceFileMetadata" }, { "type": "null" } - ] + ], + "default": null }, - "entities": { - "type": "array", - "items": { - "$ref": "#/definitions/Entity" - }, - "default": [] + "meta": { + "type": "object", + "propertyNames": { + "type": "string" + } }, - "measures": { + "tags": { "type": "array", "items": { - "$ref": "#/definitions/Measure" - }, - "default": [] + "type": "string" + } }, - "dimensions": { + "config": { + "$ref": "#/$defs/MetricConfig" + }, + "unrendered_config": { + "type": "object", + "propertyNames": { + "type": "string" + } + }, + "sources": { "type": "array", "items": { - "$ref": "#/definitions/Dimension" - }, - "default": [] - }, - "metadata": { - "oneOf": [ - { - "$ref": "#/definitions/SourceFileMetadata" - }, - { - "type": "null" + "type": "array", + "items": { + "type": "string" } - ] + } }, "depends_on": { - "$ref": "#/definitions/DependsOn", - "default": { - "macros": [], - "nodes": [] - } + "$ref": "#/$defs/DependsOn" }, "refs": { "type": "array", "items": { - "$ref": "#/definitions/RefArgs" - }, - "default": [] - }, - "created_at": { - "type": "number", - "default": 1691440799.330652 + "$ref": "#/$defs/RefArgs" + } }, - "config": { - "$ref": "#/definitions/SemanticModelConfig", - "default": { - "enabled": true + "metrics": { + "type": "array", + "items": { + "type": "array", + "items": { + "type": "string" + } } }, - "primary_entity": { - "oneOf": [ + "created_at": { + "type": "number" + }, + "group": { + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null } }, "additionalProperties": false, - "description": "SemanticModel(name: str, resource_type: dbt.node_types.NodeType, package_name: str, path: str, original_file_path: str, unique_id: str, fqn: List[str], model: str, node_relation: Union[dbt.contracts.graph.nodes.NodeRelation, NoneType], description: Union[str, NoneType] = None, defaults: Union[dbt.contracts.graph.semantic_models.Defaults, NoneType] = None, entities: Sequence[dbt.contracts.graph.semantic_models.Entity] = , measures: Sequence[dbt.contracts.graph.semantic_models.Measure] = , dimensions: Sequence[dbt.contracts.graph.semantic_models.Dimension] = , metadata: Union[dbt.contracts.graph.semantic_models.SourceFileMetadata, NoneType] = None, depends_on: dbt.contracts.graph.nodes.DependsOn = , refs: List[dbt.contracts.graph.nodes.RefArgs] = , created_at: float = , config: dbt.contracts.graph.model_config.SemanticModelConfig = , primary_entity: Union[str, NoneType] = None)" + "required": [ + "name", + "resource_type", + "package_name", + "path", + "original_file_path", + "unique_id", + "fqn", + "description", + "label", + "type", + "type_params" + ] }, - "NodeRelation": { + "Group": { "type": "object", + "title": "Group", + "properties": { + "name": { + "type": "string" + }, + "resource_type": { + "const": "group" + }, + "package_name": { + "type": "string" + }, + "path": { + "type": "string" + }, + "original_file_path": { + "type": "string" + }, + "unique_id": { + "type": "string" + }, + "owner": { + "$ref": "#/$defs/Owner" + } + }, + "additionalProperties": false, "required": [ - "alias", - "schema_name" - ], + "name", + "resource_type", + "package_name", + "path", + "original_file_path", + "unique_id", + "owner" + ] + }, + "NodeRelation": { + "type": "object", + "title": "NodeRelation", "properties": { "alias": { "type": "string" @@ -5277,59 +4869,60 @@ "type": "string" }, "database": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "relation_name": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null } }, "additionalProperties": false, - "description": "NodeRelation(alias: str, schema_name: str, database: Union[str, NoneType] = None, relation_name: Union[str, NoneType] = None)" + "required": [ + "alias", + "schema_name" + ] }, "Defaults": { "type": "object", - "required": [], + "title": "Defaults", "properties": { "agg_time_dimension": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null } }, - "additionalProperties": false, - "description": "Defaults(agg_time_dimension: Union[str, NoneType] = None)" + "additionalProperties": false }, "Entity": { "type": "object", - "required": [ - "name", - "type" - ], + "title": "Entity", "properties": { "name": { "type": "string" }, "type": { - "type": "string", "enum": [ "foreign", "natural", @@ -5338,51 +4931,113 @@ ] }, "description": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "role": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "expr": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null } }, "additionalProperties": false, - "description": "Entity(name: str, type: dbt_semantic_interfaces.type_enums.entity_type.EntityType, description: Union[str, NoneType] = None, role: Union[str, NoneType] = None, expr: Union[str, NoneType] = None)" - }, - "Measure": { - "type": "object", "required": [ "name", - "agg" - ], + "type" + ] + }, + "MeasureAggregationParameters": { + "type": "object", + "title": "MeasureAggregationParameters", "properties": { - "name": { - "type": "string" + "percentile": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null + }, + "use_discrete_percentile": { + "type": "boolean", + "default": false + }, + "use_approximate_percentile": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + }, + "NonAdditiveDimension": { + "type": "object", + "title": "NonAdditiveDimension", + "properties": { + "name": { + "type": "string" + }, + "window_choice": { + "enum": [ + "sum", + "min", + "max", + "count_distinct", + "sum_boolean", + "average", + "percentile", + "median", + "count" + ] + }, + "window_groupings": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false, + "required": [ + "name", + "window_choice", + "window_groupings" + ] + }, + "Measure": { + "type": "object", + "title": "Measure", + "properties": { + "name": { + "type": "string" }, "agg": { - "type": "string", "enum": [ "sum", "min", @@ -5396,248 +5051,610 @@ ] }, "description": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "create_metric": { "type": "boolean", "default": false }, "expr": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "agg_params": { - "oneOf": [ + "anyOf": [ { - "$ref": "#/definitions/MeasureAggregationParameters" + "$ref": "#/$defs/MeasureAggregationParameters" }, { "type": "null" } - ] + ], + "default": null }, "non_additive_dimension": { - "oneOf": [ + "anyOf": [ { - "$ref": "#/definitions/NonAdditiveDimension" + "$ref": "#/$defs/NonAdditiveDimension" }, { "type": "null" } - ] + ], + "default": null }, "agg_time_dimension": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null } }, "additionalProperties": false, - "description": "Measure(name: str, agg: dbt_semantic_interfaces.type_enums.aggregation_type.AggregationType, description: Union[str, NoneType] = None, create_metric: bool = False, expr: Union[str, NoneType] = None, agg_params: Union[dbt.contracts.graph.semantic_models.MeasureAggregationParameters, NoneType] = None, non_additive_dimension: Union[dbt.contracts.graph.semantic_models.NonAdditiveDimension, NoneType] = None, agg_time_dimension: Union[str, NoneType] = None)" + "required": [ + "name", + "agg" + ] }, - "MeasureAggregationParameters": { + "DimensionValidityParams": { "type": "object", - "required": [], + "title": "DimensionValidityParams", "properties": { - "percentile": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "null" - } - ] - }, - "use_discrete_percentile": { + "is_start": { "type": "boolean", "default": false }, - "use_approximate_percentile": { + "is_end": { "type": "boolean", "default": false } }, - "additionalProperties": false, - "description": "MeasureAggregationParameters(percentile: Union[float, NoneType] = None, use_discrete_percentile: bool = False, use_approximate_percentile: bool = False)" + "additionalProperties": false }, - "NonAdditiveDimension": { + "DimensionTypeParams": { "type": "object", - "required": [ - "name", - "window_choice", - "window_groupings" - ], + "title": "DimensionTypeParams", "properties": { - "name": { - "type": "string" - }, - "window_choice": { - "type": "string", + "time_granularity": { "enum": [ - "sum", - "min", - "max", - "count_distinct", - "sum_boolean", - "average", - "percentile", - "median", - "count" + "day", + "week", + "month", + "quarter", + "year" ] }, - "window_groupings": { - "type": "array", - "items": { - "type": "string" - } + "validity_params": { + "anyOf": [ + { + "$ref": "#/$defs/DimensionValidityParams" + }, + { + "type": "null" + } + ], + "default": null } }, "additionalProperties": false, - "description": "NonAdditiveDimension(name: str, window_choice: dbt_semantic_interfaces.type_enums.aggregation_type.AggregationType, window_groupings: List[str])" + "required": [ + "time_granularity" + ] }, "Dimension": { "type": "object", - "required": [ - "name", - "type" - ], + "title": "Dimension", "properties": { "name": { "type": "string" }, "type": { - "type": "string", "enum": [ "categorical", "time" ] }, "description": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "is_partition": { "type": "boolean", "default": false }, "type_params": { - "oneOf": [ + "anyOf": [ { - "$ref": "#/definitions/DimensionTypeParams" + "$ref": "#/$defs/DimensionTypeParams" }, { "type": "null" } - ] + ], + "default": null }, "expr": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ] + ], + "default": null }, "metadata": { - "oneOf": [ + "anyOf": [ { - "$ref": "#/definitions/SourceFileMetadata" + "$ref": "#/$defs/SourceFileMetadata" }, { "type": "null" } - ] + ], + "default": null } }, "additionalProperties": false, - "description": "Dimension(name: str, type: dbt_semantic_interfaces.type_enums.dimension_type.DimensionType, description: Union[str, NoneType] = None, is_partition: bool = False, type_params: Union[dbt.contracts.graph.semantic_models.DimensionTypeParams, NoneType] = None, expr: Union[str, NoneType] = None, metadata: Union[dbt.contracts.graph.semantic_models.SourceFileMetadata, NoneType] = None)" + "required": [ + "name", + "type" + ] }, - "DimensionTypeParams": { + "SemanticModelConfig": { "type": "object", - "required": [ - "time_granularity" - ], + "title": "SemanticModelConfig", "properties": { - "time_granularity": { - "type": "string", + "_extra": { + "type": "object", + "propertyNames": { + "type": "string" + } + }, + "enabled": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": true + }, + "SemanticModel": { + "type": "object", + "title": "SemanticModel", + "properties": { + "name": { + "type": "string" + }, + "resource_type": { "enum": [ - "day", - "week", - "month", - "quarter", - "year" + "model", + "analysis", + "test", + "snapshot", + "operation", + "seed", + "rpc", + "sql_operation", + "doc", + "source", + "macro", + "exposure", + "metric", + "group", + "semantic_model" ] }, - "validity_params": { - "oneOf": [ + "package_name": { + "type": "string" + }, + "path": { + "type": "string" + }, + "original_file_path": { + "type": "string" + }, + "unique_id": { + "type": "string" + }, + "fqn": { + "type": "array", + "items": { + "type": "string" + } + }, + "model": { + "type": "string" + }, + "node_relation": { + "anyOf": [ { - "$ref": "#/definitions/DimensionValidityParams" + "$ref": "#/$defs/NodeRelation" }, { "type": "null" } ] + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null + }, + "defaults": { + "anyOf": [ + { + "$ref": "#/$defs/Defaults" + }, + { + "type": "null" + } + ], + "default": null + }, + "entities": { + "type": "array", + "items": { + "$ref": "#/$defs/Entity" + } + }, + "measures": { + "type": "array", + "items": { + "$ref": "#/$defs/Measure" + } + }, + "dimensions": { + "type": "array", + "items": { + "$ref": "#/$defs/Dimension" + } + }, + "metadata": { + "anyOf": [ + { + "$ref": "#/$defs/SourceFileMetadata" + }, + { + "type": "null" + } + ], + "default": null + }, + "depends_on": { + "$ref": "#/$defs/DependsOn" + }, + "refs": { + "type": "array", + "items": { + "$ref": "#/$defs/RefArgs" + } + }, + "created_at": { + "type": "number" + }, + "config": { + "$ref": "#/$defs/SemanticModelConfig" + }, + "primary_entity": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null } }, "additionalProperties": false, - "description": "DimensionTypeParams(time_granularity: dbt_semantic_interfaces.type_enums.time_granularity.TimeGranularity, validity_params: Union[dbt.contracts.graph.semantic_models.DimensionValidityParams, NoneType] = None)" + "required": [ + "name", + "resource_type", + "package_name", + "path", + "original_file_path", + "unique_id", + "fqn", + "model", + "node_relation" + ] }, - "DimensionValidityParams": { + "WritableManifest": { "type": "object", - "required": [], + "title": "WritableManifest", "properties": { - "is_start": { - "type": "boolean", - "default": false + "metadata": { + "$ref": "#/$defs/ManifestMetadata" }, - "is_end": { - "type": "boolean", - "default": false + "nodes": { + "type": "object", + "description": "The nodes defined in the dbt project and its dependencies", + "additionalProperties": { + "anyOf": [ + { + "$ref": "#/$defs/AnalysisNode" + }, + { + "$ref": "#/$defs/SingularTestNode" + }, + { + "$ref": "#/$defs/HookNode" + }, + { + "$ref": "#/$defs/ModelNode" + }, + { + "$ref": "#/$defs/RPCNode" + }, + { + "$ref": "#/$defs/SqlNode" + }, + { + "$ref": "#/$defs/GenericTestNode" + }, + { + "$ref": "#/$defs/SnapshotNode" + }, + { + "$ref": "#/$defs/SeedNode" + } + ] + }, + "propertyNames": { + "type": "string" + } + }, + "sources": { + "type": "object", + "description": "The sources defined in the dbt project and its dependencies", + "additionalProperties": { + "$ref": "#/$defs/SourceDefinition" + }, + "propertyNames": { + "type": "string" + } + }, + "macros": { + "type": "object", + "description": "The macros defined in the dbt project and its dependencies", + "additionalProperties": { + "$ref": "#/$defs/Macro" + }, + "propertyNames": { + "type": "string" + } + }, + "docs": { + "type": "object", + "description": "The docs defined in the dbt project and its dependencies", + "additionalProperties": { + "$ref": "#/$defs/Documentation" + }, + "propertyNames": { + "type": "string" + } + }, + "exposures": { + "type": "object", + "description": "The exposures defined in the dbt project and its dependencies", + "additionalProperties": { + "$ref": "#/$defs/Exposure" + }, + "propertyNames": { + "type": "string" + } + }, + "metrics": { + "type": "object", + "description": "The metrics defined in the dbt project and its dependencies", + "additionalProperties": { + "$ref": "#/$defs/Metric" + }, + "propertyNames": { + "type": "string" + } + }, + "groups": { + "type": "object", + "description": "The groups defined in the dbt project", + "additionalProperties": { + "$ref": "#/$defs/Group" + }, + "propertyNames": { + "type": "string" + } + }, + "selectors": { + "type": "object", + "description": "The selectors defined in selectors.yml", + "propertyNames": { + "type": "string" + } + }, + "disabled": { + "description": "A mapping of the disabled nodes in the target", + "anyOf": [ + { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "anyOf": [ + { + "$ref": "#/$defs/AnalysisNode" + }, + { + "$ref": "#/$defs/SingularTestNode" + }, + { + "$ref": "#/$defs/HookNode" + }, + { + "$ref": "#/$defs/ModelNode" + }, + { + "$ref": "#/$defs/RPCNode" + }, + { + "$ref": "#/$defs/SqlNode" + }, + { + "$ref": "#/$defs/GenericTestNode" + }, + { + "$ref": "#/$defs/SnapshotNode" + }, + { + "$ref": "#/$defs/SeedNode" + }, + { + "$ref": "#/$defs/SourceDefinition" + }, + { + "$ref": "#/$defs/Exposure" + }, + { + "$ref": "#/$defs/Metric" + }, + { + "$ref": "#/$defs/SemanticModel" + } + ] + } + }, + "propertyNames": { + "type": "string" + } + }, + { + "type": "null" + } + ] + }, + "parent_map": { + "description": "A mapping from\u00a0child nodes to their dependencies", + "anyOf": [ + { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "type": "string" + } + }, + "propertyNames": { + "type": "string" + } + }, + { + "type": "null" + } + ] + }, + "child_map": { + "description": "A mapping from parent nodes to their dependents", + "anyOf": [ + { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "type": "string" + } + }, + "propertyNames": { + "type": "string" + } + }, + { + "type": "null" + } + ] + }, + "group_map": { + "description": "A mapping from group names to their nodes", + "anyOf": [ + { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "type": "string" + } + }, + "propertyNames": { + "type": "string" + } + }, + { + "type": "null" + } + ] + }, + "semantic_models": { + "type": "object", + "description": "The semantic models defined in the dbt project", + "additionalProperties": { + "$ref": "#/$defs/SemanticModel" + }, + "propertyNames": { + "type": "string" + } } }, "additionalProperties": false, - "description": "DimensionValidityParams(is_start: bool = False, is_end: bool = False)" - }, - "SemanticModelConfig": { - "type": "object", - "required": [], - "properties": { - "enabled": { - "type": "boolean", - "default": true - } - }, - "additionalProperties": true, - "description": "SemanticModelConfig(_extra: Dict[str, Any] = , enabled: bool = True)" + "required": [ + "metadata", + "nodes", + "sources", + "macros", + "docs", + "exposures", + "metrics", + "groups", + "selectors", + "disabled", + "parent_map", + "child_map", + "group_map", + "semantic_models" + ] } }, - "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://schemas.getdbt.com/dbt/manifest/v11.json" } diff --git a/schemas/dbt/run-results/v4.json b/schemas/dbt/run-results/v4.json index a1948721752..029886a3a45 100644 --- a/schemas/dbt/run-results/v4.json +++ b/schemas/dbt/run-results/v4.json @@ -1,86 +1,89 @@ { - "type": "object", - "required": [ - "metadata", - "results", - "elapsed_time" - ], - "properties": { - "metadata": { - "$ref": "#/definitions/BaseArtifactMetadata" - }, - "results": { - "type": "array", - "items": { - "$ref": "#/definitions/RunResultOutput" - } - }, - "elapsed_time": { - "type": "number" - }, - "args": { - "type": "object", - "default": {} - } - }, - "additionalProperties": false, - "description": "RunResultsArtifact(metadata: dbt.contracts.util.BaseArtifactMetadata, results: Sequence[dbt.contracts.results.RunResultOutput], elapsed_time: float, args: Dict[str, Any] = )", - "definitions": { + "$ref": "#/$defs/RunResultsArtifact", + "$defs": { "BaseArtifactMetadata": { "type": "object", - "required": [ - "dbt_schema_version" - ], + "title": "BaseArtifactMetadata", "properties": { "dbt_schema_version": { "type": "string" }, "dbt_version": { "type": "string", - "default": "1.5.0a1" + "default": "1.7.0b1" }, "generated_at": { - "type": "string", - "format": "date-time", - "default": "2023-02-09T23:46:55.264544Z" + "type": "string" }, "invocation_id": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ], - "default": "e6a9b266-203d-4fec-93af-fb8f55423a6b" + ] }, "env": { "type": "object", "additionalProperties": { "type": "string" }, - "default": {} + "propertyNames": { + "type": "string" + } } }, "additionalProperties": false, - "description": "BaseArtifactMetadata(dbt_schema_version: str, dbt_version: str = '1.5.0a1', generated_at: datetime.datetime = , invocation_id: Optional[str] = , env: Dict[str, str] = )" + "required": [ + "dbt_schema_version" + ] }, - "RunResultOutput": { + "TimingInfo": { "type": "object", + "title": "TimingInfo", + "properties": { + "name": { + "type": "string" + }, + "started_at": { + "anyOf": [ + { + "type": "string", + "format": "date-time" + }, + { + "type": "null" + } + ], + "default": null + }, + "completed_at": { + "anyOf": [ + { + "type": "string", + "format": "date-time" + }, + { + "type": "null" + } + ], + "default": null + } + }, + "additionalProperties": false, "required": [ - "status", - "timing", - "thread_id", - "execution_time", - "adapter_response", - "unique_id" - ], + "name" + ] + }, + "RunResultOutput": { + "type": "object", + "title": "RunResultOutput", "properties": { "status": { - "oneOf": [ + "anyOf": [ { - "type": "string", "enum": [ "success", "error", @@ -88,7 +91,6 @@ ] }, { - "type": "string", "enum": [ "pass", "error", @@ -98,7 +100,6 @@ ] }, { - "type": "string", "enum": [ "pass", "warn", @@ -111,7 +112,7 @@ "timing": { "type": "array", "items": { - "$ref": "#/definitions/TimingInfo" + "$ref": "#/$defs/TimingInfo" } }, "thread_id": { @@ -121,10 +122,13 @@ "type": "number" }, "adapter_response": { - "type": "object" + "type": "object", + "propertyNames": { + "type": "string" + } }, "message": { - "oneOf": [ + "anyOf": [ { "type": "string" }, @@ -134,7 +138,7 @@ ] }, "failures": { - "oneOf": [ + "anyOf": [ { "type": "integer" }, @@ -148,255 +152,47 @@ } }, "additionalProperties": false, - "description": "RunResultOutput(status: Union[dbt.contracts.results.RunStatus, dbt.contracts.results.TestStatus, dbt.contracts.results.FreshnessStatus], timing: List[dbt.contracts.results.TimingInfo], thread_id: str, execution_time: float, adapter_response: Dict[str, Any], message: Optional[str], failures: Optional[int], unique_id: str)" - }, - "TimingInfo": { - "type": "object", "required": [ - "name" - ], - "properties": { - "name": { - "type": "string" - }, - "started_at": { - "oneOf": [ - { - "type": "string", - "format": "date-time" - }, - { - "type": "null" - } - ] - }, - "completed_at": { - "oneOf": [ - { - "type": "string", - "format": "date-time" - }, - { - "type": "null" - } - ] - } - }, - "additionalProperties": false, - "description": "TimingInfo(name: str, started_at: Optional[datetime.datetime] = None, completed_at: Optional[datetime.datetime] = None)" - }, - "FreshnessMetadata": { - "type": "object", - "required": [], - "properties": { - "dbt_schema_version": { - "type": "string", - "default": "https://schemas.getdbt.com/dbt/sources/v3.json" - }, - "dbt_version": { - "type": "string", - "default": "1.5.0a1" - }, - "generated_at": { - "type": "string", - "format": "date-time", - "default": "2023-02-09T23:46:55.263337Z" - }, - "invocation_id": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": "e6a9b266-203d-4fec-93af-fb8f55423a6b" - }, - "env": { - "type": "object", - "additionalProperties": { - "type": "string" - }, - "default": {} - } - }, - "additionalProperties": false, - "description": "FreshnessMetadata(dbt_schema_version: str = , dbt_version: str = '1.5.0a1', generated_at: datetime.datetime = , invocation_id: Optional[str] = , env: Dict[str, str] = )" - }, - "SourceFreshnessRuntimeError": { - "type": "object", - "required": [ - "unique_id", - "status" - ], - "properties": { - "unique_id": { - "type": "string" - }, - "error": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "integer" - }, - { - "type": "null" - } - ] - }, - "status": { - "type": "string", - "enum": [ - "runtime error" - ] - } - }, - "additionalProperties": false, - "description": "SourceFreshnessRuntimeError(unique_id: str, error: Union[str, int, NoneType], status: dbt.contracts.results.FreshnessErrorEnum)" - }, - "SourceFreshnessOutput": { - "type": "object", - "required": [ - "unique_id", - "max_loaded_at", - "snapshotted_at", - "max_loaded_at_time_ago_in_s", "status", - "criteria", - "adapter_response", "timing", "thread_id", - "execution_time" - ], + "execution_time", + "adapter_response", + "message", + "failures", + "unique_id" + ] + }, + "RunResultsArtifact": { + "type": "object", + "title": "RunResultsArtifact", "properties": { - "unique_id": { - "type": "string" - }, - "max_loaded_at": { - "type": "string", - "format": "date-time" - }, - "snapshotted_at": { - "type": "string", - "format": "date-time" - }, - "max_loaded_at_time_ago_in_s": { - "type": "number" - }, - "status": { - "type": "string", - "enum": [ - "pass", - "warn", - "error", - "runtime error" - ] + "metadata": { + "$ref": "#/$defs/BaseArtifactMetadata" }, - "criteria": { - "$ref": "#/definitions/FreshnessThreshold" - }, - "adapter_response": { - "type": "object" - }, - "timing": { + "results": { "type": "array", "items": { - "$ref": "#/definitions/TimingInfo" + "$ref": "#/$defs/RunResultOutput" } }, - "thread_id": { - "type": "string" - }, - "execution_time": { + "elapsed_time": { "type": "number" - } - }, - "additionalProperties": false, - "description": "SourceFreshnessOutput(unique_id: str, max_loaded_at: datetime.datetime, snapshotted_at: datetime.datetime, max_loaded_at_time_ago_in_s: float, status: dbt.contracts.results.FreshnessStatus, criteria: dbt.contracts.graph.unparsed.FreshnessThreshold, adapter_response: Dict[str, Any], timing: List[dbt.contracts.results.TimingInfo], thread_id: str, execution_time: float)" - }, - "FreshnessThreshold": { - "type": "object", - "required": [], - "properties": { - "warn_after": { - "oneOf": [ - { - "$ref": "#/definitions/Time" - }, - { - "type": "null" - } - ], - "default": { - "count": null, - "period": null - } }, - "error_after": { - "oneOf": [ - { - "$ref": "#/definitions/Time" - }, - { - "type": "null" - } - ], - "default": { - "count": null, - "period": null + "args": { + "type": "object", + "propertyNames": { + "type": "string" } - }, - "filter": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - } - }, - "additionalProperties": false, - "description": "FreshnessThreshold(warn_after: Optional[dbt.contracts.graph.unparsed.Time] = , error_after: Optional[dbt.contracts.graph.unparsed.Time] = , filter: Optional[str] = None)" - }, - "Time": { - "type": "object", - "required": [], - "properties": { - "count": { - "oneOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ] - }, - "period": { - "oneOf": [ - { - "type": "string", - "enum": [ - "minute", - "hour", - "day" - ] - }, - { - "type": "null" - } - ] } }, "additionalProperties": false, - "description": "Time(count: Optional[int] = None, period: Optional[dbt.contracts.graph.unparsed.TimePeriod] = None)" + "required": [ + "metadata", + "results", + "elapsed_time" + ] } }, - "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://schemas.getdbt.com/dbt/run-results/v4.json" } diff --git a/schemas/dbt/sources/v3.json b/schemas/dbt/sources/v3.json index e36e44b90f7..31dc016bff9 100644 --- a/schemas/dbt/sources/v3.json +++ b/schemas/dbt/sources/v3.json @@ -1,85 +1,51 @@ { - "type": "object", - "required": [ - "metadata", - "results", - "elapsed_time" - ], - "properties": { - "metadata": { - "$ref": "#/definitions/FreshnessMetadata" - }, - "results": { - "type": "array", - "items": { - "oneOf": [ - { - "$ref": "#/definitions/SourceFreshnessRuntimeError" - }, - { - "$ref": "#/definitions/SourceFreshnessOutput" - } - ] - } - }, - "elapsed_time": { - "type": "number" - } - }, - "additionalProperties": false, - "description": "FreshnessExecutionResultArtifact(metadata: dbt.contracts.results.FreshnessMetadata, results: Sequence[Union[dbt.contracts.results.SourceFreshnessRuntimeError, dbt.contracts.results.SourceFreshnessOutput]], elapsed_time: float)", - "definitions": { + "$ref": "#/$defs/FreshnessExecutionResultArtifact", + "$defs": { "FreshnessMetadata": { "type": "object", - "required": [], + "title": "FreshnessMetadata", "properties": { "dbt_schema_version": { - "type": "string", - "default": "https://schemas.getdbt.com/dbt/sources/v3.json" + "type": "string" }, "dbt_version": { "type": "string", - "default": "1.5.0a1" + "default": "1.7.0b1" }, "generated_at": { - "type": "string", - "format": "date-time", - "default": "2023-02-18T14:20:00.362449Z" + "type": "string" }, "invocation_id": { - "oneOf": [ + "anyOf": [ { "type": "string" }, { "type": "null" } - ], - "default": "b1e277bf-2a2c-4d49-9d37-8d1a72cf26c7" + ] }, "env": { "type": "object", "additionalProperties": { "type": "string" }, - "default": {} + "propertyNames": { + "type": "string" + } } }, - "additionalProperties": false, - "description": "FreshnessMetadata(dbt_schema_version: str = , dbt_version: str = '1.5.0a1', generated_at: datetime.datetime = , invocation_id: Optional[str] = , env: Dict[str, str] = )" + "additionalProperties": false }, "SourceFreshnessRuntimeError": { "type": "object", - "required": [ - "unique_id", - "status" - ], + "title": "SourceFreshnessRuntimeError", "properties": { "unique_id": { "type": "string" }, "error": { - "oneOf": [ + "anyOf": [ { "type": "string" }, @@ -92,165 +58,98 @@ ] }, "status": { - "type": "string", "enum": [ "runtime error" ] } }, "additionalProperties": false, - "description": "SourceFreshnessRuntimeError(unique_id: str, error: Union[str, int, NoneType], status: dbt.contracts.results.FreshnessErrorEnum)" - }, - "SourceFreshnessOutput": { - "type": "object", "required": [ "unique_id", - "max_loaded_at", - "snapshotted_at", - "max_loaded_at_time_ago_in_s", - "status", - "criteria", - "adapter_response", - "timing", - "thread_id", - "execution_time" - ], - "properties": { - "unique_id": { - "type": "string" - }, - "max_loaded_at": { - "type": "string", - "format": "date-time" - }, - "snapshotted_at": { - "type": "string", - "format": "date-time" - }, - "max_loaded_at_time_ago_in_s": { - "type": "number" - }, - "status": { - "type": "string", - "enum": [ - "pass", - "warn", - "error", - "runtime error" - ] - }, - "criteria": { - "$ref": "#/definitions/FreshnessThreshold" - }, - "adapter_response": { - "type": "object" - }, - "timing": { - "type": "array", - "items": { - "$ref": "#/definitions/TimingInfo" - } - }, - "thread_id": { - "type": "string" - }, - "execution_time": { - "type": "number" - } - }, - "additionalProperties": false, - "description": "SourceFreshnessOutput(unique_id: str, max_loaded_at: datetime.datetime, snapshotted_at: datetime.datetime, max_loaded_at_time_ago_in_s: float, status: dbt.contracts.results.FreshnessStatus, criteria: dbt.contracts.graph.unparsed.FreshnessThreshold, adapter_response: Dict[str, Any], timing: List[dbt.contracts.results.TimingInfo], thread_id: str, execution_time: float)" + "error", + "status" + ] }, - "FreshnessThreshold": { + "Time": { "type": "object", - "required": [], + "title": "Time", "properties": { - "warn_after": { - "oneOf": [ + "count": { + "anyOf": [ { - "$ref": "#/definitions/Time" + "type": "integer" }, { "type": "null" } ], - "default": { - "count": null, - "period": null - } + "default": null }, - "error_after": { - "oneOf": [ + "period": { + "anyOf": [ { - "$ref": "#/definitions/Time" + "enum": [ + "minute", + "hour", + "day" + ] }, { "type": "null" } ], - "default": { - "count": null, - "period": null - } - }, - "filter": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] + "default": null } }, - "additionalProperties": false, - "description": "FreshnessThreshold(warn_after: Optional[dbt.contracts.graph.unparsed.Time] = , error_after: Optional[dbt.contracts.graph.unparsed.Time] = , filter: Optional[str] = None)" + "additionalProperties": false }, - "Time": { + "FreshnessThreshold": { "type": "object", - "required": [], + "title": "FreshnessThreshold", "properties": { - "count": { - "oneOf": [ + "warn_after": { + "anyOf": [ { - "type": "integer" + "$ref": "#/$defs/Time" }, { "type": "null" } ] }, - "period": { - "oneOf": [ + "error_after": { + "anyOf": [ { - "type": "string", - "enum": [ - "minute", - "hour", - "day" - ] + "$ref": "#/$defs/Time" }, { "type": "null" } ] + }, + "filter": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null } }, - "additionalProperties": false, - "description": "Time(count: Optional[int] = None, period: Optional[dbt.contracts.graph.unparsed.TimePeriod] = None)" + "additionalProperties": false }, "TimingInfo": { "type": "object", - "required": [ - "name" - ], + "title": "TimingInfo", "properties": { "name": { "type": "string" }, "started_at": { - "oneOf": [ + "anyOf": [ { "type": "string", "format": "date-time" @@ -258,10 +157,11 @@ { "type": "null" } - ] + ], + "default": null }, "completed_at": { - "oneOf": [ + "anyOf": [ { "type": "string", "format": "date-time" @@ -269,13 +169,106 @@ { "type": "null" } + ], + "default": null + } + }, + "additionalProperties": false, + "required": [ + "name" + ] + }, + "SourceFreshnessOutput": { + "type": "object", + "title": "SourceFreshnessOutput", + "properties": { + "unique_id": { + "type": "string" + }, + "max_loaded_at": { + "type": "string" + }, + "snapshotted_at": { + "type": "string" + }, + "max_loaded_at_time_ago_in_s": { + "type": "number" + }, + "status": { + "enum": [ + "pass", + "warn", + "error", + "runtime error" ] + }, + "criteria": { + "$ref": "#/$defs/FreshnessThreshold" + }, + "adapter_response": { + "type": "object", + "propertyNames": { + "type": "string" + } + }, + "timing": { + "type": "array", + "items": { + "$ref": "#/$defs/TimingInfo" + } + }, + "thread_id": { + "type": "string" + }, + "execution_time": { + "type": "number" } }, "additionalProperties": false, - "description": "TimingInfo(name: str, started_at: Optional[datetime.datetime] = None, completed_at: Optional[datetime.datetime] = None)" + "required": [ + "unique_id", + "max_loaded_at", + "snapshotted_at", + "max_loaded_at_time_ago_in_s", + "status", + "criteria", + "adapter_response", + "timing", + "thread_id", + "execution_time" + ] + }, + "FreshnessExecutionResultArtifact": { + "type": "object", + "title": "FreshnessExecutionResultArtifact", + "properties": { + "metadata": { + "$ref": "#/$defs/FreshnessMetadata" + }, + "results": { + "type": "array", + "items": { + "anyOf": [ + { + "$ref": "#/$defs/SourceFreshnessRuntimeError" + }, + { + "$ref": "#/$defs/SourceFreshnessOutput" + } + ] + } + }, + "elapsed_time": { + "type": "number" + } + }, + "additionalProperties": false, + "required": [ + "metadata", + "results", + "elapsed_time" + ] } }, - "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://schemas.getdbt.com/dbt/sources/v3.json" } diff --git a/tests/functional/artifacts/test_docs_generate_defer.py b/tests/functional/artifacts/test_docs_generate_defer.py index e85949819ac..dc5eef6e030 100644 --- a/tests/functional/artifacts/test_docs_generate_defer.py +++ b/tests/functional/artifacts/test_docs_generate_defer.py @@ -29,5 +29,12 @@ def test_generate_defer( self.copy_state() # defer test, it succeeds - results = run_dbt(["docs", "generate", "--state", "./state", "--defer"]) - assert results.nodes["model.test.model"] + catalog = run_dbt(["docs", "generate", "--state", "./state", "--defer"]) + assert catalog.nodes["model.test.model"] + + # Check that catalog validates with jsonschema + catalog_dict = catalog.to_dict() + try: + catalog.validate(catalog_dict) + except Exception: + raise pytest.fail("Catalog validation failed") diff --git a/tests/functional/configs/test_configs.py b/tests/functional/configs/test_configs.py index 49a3222910a..69c3d2b1a5f 100644 --- a/tests/functional/configs/test_configs.py +++ b/tests/functional/configs/test_configs.py @@ -1,4 +1,4 @@ -from hologram import ValidationError +from dbt.dataclass_schema import ValidationError import pytest import os diff --git a/tests/functional/configs/test_custom_node_colors_configs.py b/tests/functional/configs/test_custom_node_colors_configs.py index a5c56b3ee0f..2eb3c53fa9c 100644 --- a/tests/functional/configs/test_custom_node_colors_configs.py +++ b/tests/functional/configs/test_custom_node_colors_configs.py @@ -2,7 +2,7 @@ from dbt.tests.util import run_dbt, get_manifest -from hologram import ValidationError +from dbt.dataclass_schema import ValidationError CUSTOM_NODE_COLOR_MODEL_LEVEL = "red" CUSTOM_NODE_COLOR_SCHEMA_LEVEL = "blue" diff --git a/tests/functional/configs/test_disabled_model.py b/tests/functional/configs/test_disabled_model.py index 4b6e74adffd..82f1e71d1c2 100644 --- a/tests/functional/configs/test_disabled_model.py +++ b/tests/functional/configs/test_disabled_model.py @@ -1,5 +1,5 @@ import pytest -from hologram import ValidationError +from dbt.dataclass_schema import ValidationError from dbt.tests.util import run_dbt, get_manifest from dbt.exceptions import CompilationError, ParsingError diff --git a/tests/functional/exposures/test_exposure_configs.py b/tests/functional/exposures/test_exposure_configs.py index 34c5570a84e..f15c98a85fd 100644 --- a/tests/functional/exposures/test_exposure_configs.py +++ b/tests/functional/exposures/test_exposure_configs.py @@ -1,5 +1,5 @@ import pytest -from hologram import ValidationError +from dbt.dataclass_schema import ValidationError from dbt.contracts.graph.model_config import ExposureConfig diff --git a/tests/functional/metrics/test_metric_configs.py b/tests/functional/metrics/test_metric_configs.py index 03b8fe2275c..f654b24ceed 100644 --- a/tests/functional/metrics/test_metric_configs.py +++ b/tests/functional/metrics/test_metric_configs.py @@ -1,5 +1,5 @@ import pytest -from hologram import ValidationError +from dbt.dataclass_schema import ValidationError from dbt.contracts.graph.model_config import MetricConfig from dbt.exceptions import CompilationError, ParsingError from dbt.tests.util import run_dbt, update_config_file, get_manifest diff --git a/tests/functional/sources/test_source_configs.py b/tests/functional/sources/test_source_configs.py index 27c4c3d8b37..09ddfddd0fa 100644 --- a/tests/functional/sources/test_source_configs.py +++ b/tests/functional/sources/test_source_configs.py @@ -1,5 +1,5 @@ import pytest -from hologram import ValidationError +from dbt.dataclass_schema import ValidationError from dbt.contracts.graph.model_config import SourceConfig diff --git a/tests/functional/sources/test_source_fresher_state.py b/tests/functional/sources/test_source_fresher_state.py index 460a44e1a92..d060072da17 100644 --- a/tests/functional/sources/test_source_fresher_state.py +++ b/tests/functional/sources/test_source_fresher_state.py @@ -16,6 +16,7 @@ models_newly_added_model_sql, models_newly_added_error_model_sql, ) +from dbt.contracts.results import FreshnessExecutionResultArtifact # TODO: We may create utility classes to handle reusable fixtures. @@ -81,6 +82,10 @@ def _assert_freshness_results(self, path, state): with open(path) as fp: data = json.load(fp) + try: + FreshnessExecutionResultArtifact.validate(data) + except Exception: + raise pytest.fail("FreshnessExecutionResultArtifact did not validate") assert set(data) == {"metadata", "results", "elapsed_time"} assert "generated_at" in data["metadata"] assert isinstance(data["elapsed_time"], float) diff --git a/tests/unit/test_contracts_graph_parsed.py b/tests/unit/test_contracts_graph_parsed.py index b45bc66b08e..21d5629bc7c 100644 --- a/tests/unit/test_contracts_graph_parsed.py +++ b/tests/unit/test_contracts_graph_parsed.py @@ -349,42 +349,6 @@ def complex_parsed_model_object(): ) -{ - "enabled": True, - "tags": [], - "meta": {}, - "materialized": "ephemeral", - "persist_docs": {}, - "quoting": {}, - "column_types": {"a": "text"}, - "on_schema_change": "ignore", - "on_configuration_change": "apply", - "grants": {}, - "packages": [], - "docs": {"show": True}, - "contract": {"enforced": False}, - "post-hook": [{"sql": 'insert into blah(a, b) select "1", 1', "transaction": True}], - "pre-hook": [], -} - -{ - "column_types": {"a": "text"}, - "enabled": True, - "materialized": "ephemeral", - "persist_docs": {}, - "post-hook": [{"sql": 'insert into blah(a, b) select "1", 1', "transaction": True}], - "pre-hook": [], - "quoting": {}, - "tags": [], - "on_schema_change": "ignore", - "on_configuration_change": "apply", - "meta": {}, - "grants": {}, - "docs": {"show": True}, - "packages": [], -} - - def test_model_basic(basic_parsed_model_object, base_parsed_model_dict, minimal_parsed_model_dict): node = basic_parsed_model_object node_dict = base_parsed_model_dict diff --git a/tests/unit/test_contracts_graph_unparsed.py b/tests/unit/test_contracts_graph_unparsed.py index ad9f6d74922..ffd70814ca9 100644 --- a/tests/unit/test_contracts_graph_unparsed.py +++ b/tests/unit/test_contracts_graph_unparsed.py @@ -131,18 +131,6 @@ def test_empty(self): self.assert_fails_validation(node_dict, cls=UnparsedRunHook) self.assert_fails_validation(node_dict, cls=UnparsedMacro) - def test_bad_type(self): - node_dict = { - "name": "foo", - "resource_type": NodeType.Source, # not valid! - "path": "/root/x/path.sql", - "original_file_path": "/root/path.sql", - "package_name": "test", - "language": "sql", - "raw_code": 'select * from {{ ref("thing") }}', - } - self.assert_fails_validation(node_dict) - class TestUnparsedRunHook(ContractTestCase): ContractType = UnparsedRunHook diff --git a/tests/unit/test_graph.py b/tests/unit/test_graph.py index fe1dc7e868a..48011cd2553 100644 --- a/tests/unit/test_graph.py +++ b/tests/unit/test_graph.py @@ -116,16 +116,6 @@ def mock_load_source_file(path, parse_file_type, project_name, saved_files): self.mock_source_file.side_effect = mock_load_source_file - @patch("dbt.parser.hooks.HookParser.get_path") - def _mock_hook_path(self): - path = FilePath( - searched_path=".", - project_root=os.path.normcase(os.getcwd()), - relative_path="dbt_project.yml", - modification_time=0.0, - ) - return path - def get_config(self, extra_cfg=None): if extra_cfg is None: extra_cfg = {} diff --git a/tests/unit/test_postgres_adapter.py b/tests/unit/test_postgres_adapter.py index d7d91a8988b..0127d0c6398 100644 --- a/tests/unit/test_postgres_adapter.py +++ b/tests/unit/test_postgres_adapter.py @@ -24,6 +24,11 @@ clear_plugin, ) +from dbt.flags import set_from_args +from argparse import Namespace + +set_from_args(Namespace(WARN_ERROR=False), None) + class TestPostgresAdapter(unittest.TestCase): def setUp(self): diff --git a/tests/unit/test_query_headers.py b/tests/unit/test_query_headers.py index 9e814720a76..dd78fc0c838 100644 --- a/tests/unit/test_query_headers.py +++ b/tests/unit/test_query_headers.py @@ -4,6 +4,10 @@ from dbt.adapters.base.query_headers import MacroQueryStringSetter from tests.unit.utils import config_from_parts_or_dicts +from dbt.flags import set_from_args +from argparse import Namespace + +set_from_args(Namespace(WARN_ERROR=False), None) class TestQueryHeaders(TestCase): diff --git a/third-party-stubs/mashumaro/__init__.pyi b/third-party-stubs/mashumaro/__init__.pyi index 59b16d3d3aa..0a67966c158 100644 --- a/third-party-stubs/mashumaro/__init__.pyi +++ b/third-party-stubs/mashumaro/__init__.pyi @@ -1,5 +1,3 @@ from mashumaro.exceptions import MissingField as MissingField from mashumaro.helper import field_options as field_options, pass_through as pass_through from mashumaro.mixins.dict import DataClassDictMixin as DataClassDictMixin -from mashumaro.mixins.msgpack import DataClassMessagePackMixin as DataClassMessagePackMixin -from mashumaro.mixins.json import DataClassJSONMixin as DataClassJSONMixin diff --git a/third-party-stubs/mashumaro/config.pyi b/third-party-stubs/mashumaro/config.pyi index 8263ceb46fe..7b30709dd9f 100644 --- a/third-party-stubs/mashumaro/config.pyi +++ b/third-party-stubs/mashumaro/config.pyi @@ -1,31 +1,26 @@ +from mashumaro.core.const import Sentinel from mashumaro.dialect import Dialect -from mashumaro.types import SerializationStrategy +from mashumaro.types import Discriminator, SerializationStrategy from typing import Any, Callable, Dict, List, Optional, Type, Union -from mashumaro.core.const import PEP_586_COMPATIBLE - -if PEP_586_COMPATIBLE: - from typing import Literal # type: ignore -else: - from typing_extensions import Literal # type: ignore +from typing_extensions import Literal TO_DICT_ADD_BY_ALIAS_FLAG: str TO_DICT_ADD_OMIT_NONE_FLAG: str ADD_DIALECT_SUPPORT: str - -CodeGenerationOption = Literal[ - "TO_DICT_ADD_BY_ALIAS_FLAG", - "TO_DICT_ADD_OMIT_NONE_FLAG", - "ADD_DIALECT_SUPPORT", -] - +ADD_SERIALIZATION_CONTEXT: str SerializationStrategyValueType = Union[SerializationStrategy, Dict[str, Union[str, Callable]]] class BaseConfig: - debug: bool = ... - code_generation_options: List[str] = ... - serialization_strategy: Dict[Any, SerializationStrategyValueType] = ... - aliases: Dict[str, str] = ... - serialize_by_alias: bool = ... - namedtuple_as_dict: bool = ... - allow_postponed_evaluation: bool = ... - dialect: Optional[Type[Dialect]] = ... + debug: bool + code_generation_options: List[str] + serialization_strategy: Dict[Any, SerializationStrategyValueType] + aliases: Dict[str, str] + serialize_by_alias: bool + namedtuple_as_dict: bool + allow_postponed_evaluation: bool + dialect: Optional[Type[Dialect]] + omit_none: Union[bool, Sentinel.MISSING] + orjson_options: Optional[int] + json_schema: Dict[str, Any] + discriminator: Optional[Discriminator] + lazy_compilation: bool diff --git a/third-party-stubs/mashumaro/core/const.pyi b/third-party-stubs/mashumaro/core/const.pyi index c76e457dfe1..dfcd13587ff 100644 --- a/third-party-stubs/mashumaro/core/const.pyi +++ b/third-party-stubs/mashumaro/core/const.pyi @@ -1,13 +1,17 @@ -from typing import Any +import enum +from _typeshed import Incomplete -PY_36: Any -PY_37: Any -PY_38: Any -PY_39: Any -PY_310: Any -PY_37_MIN: Any -PY_38_MIN: Any -PY_39_MIN: Any -PY_310_MIN = PY_310 +PY_37: Incomplete +PY_38: Incomplete +PY_39: Incomplete +PY_310: Incomplete +PY_311_MIN: Incomplete +PY_310_MIN: Incomplete +PY_39_MIN: Incomplete +PY_38_MIN: Incomplete +PY_37_MIN: Incomplete PEP_585_COMPATIBLE = PY_39_MIN PEP_586_COMPATIBLE = PY_38_MIN + +class Sentinel(enum.Enum): + MISSING: Incomplete diff --git a/third-party-stubs/mashumaro/core/helpers.pyi b/third-party-stubs/mashumaro/core/helpers.pyi index 326e5cccf4c..3470d4162f9 100644 --- a/third-party-stubs/mashumaro/core/helpers.pyi +++ b/third-party-stubs/mashumaro/core/helpers.pyi @@ -1,3 +1,10 @@ import datetime +from _typeshed import Incomplete + +UTC_OFFSET_PATTERN: str def parse_timezone(s: str) -> datetime.timezone: ... + +class ConfigValue: + name: Incomplete + def __init__(self, name: str) -> None: ... diff --git a/third-party-stubs/mashumaro/core/meta/builder.pyi b/third-party-stubs/mashumaro/core/meta/builder.pyi deleted file mode 100644 index 99bc7f98174..00000000000 --- a/third-party-stubs/mashumaro/core/meta/builder.pyi +++ /dev/null @@ -1,115 +0,0 @@ -from mashumaro.core.helpers import * -import types -import typing -from base64 import decodebytes as decodebytes, encodebytes as encodebytes -from dataclasses import Field -from mashumaro.config import ( - ADD_DIALECT_SUPPORT as ADD_DIALECT_SUPPORT, - BaseConfig as BaseConfig, - TO_DICT_ADD_BY_ALIAS_FLAG as TO_DICT_ADD_BY_ALIAS_FLAG, - TO_DICT_ADD_OMIT_NONE_FLAG as TO_DICT_ADD_OMIT_NONE_FLAG, -) -from mashumaro.core.const import PY_39_MIN as PY_39_MIN -from mashumaro.core.meta.helpers import ( - get_args as get_args, - get_class_that_defines_field as get_class_that_defines_field, - get_class_that_defines_method as get_class_that_defines_method, - get_literal_values as get_literal_values, - get_name_error_name as get_name_error_name, - get_type_origin as get_type_origin, - is_class_var as is_class_var, - is_dataclass_dict_mixin as is_dataclass_dict_mixin, - is_dataclass_dict_mixin_subclass as is_dataclass_dict_mixin_subclass, - is_dialect_subclass as is_dialect_subclass, - is_generic as is_generic, - is_init_var as is_init_var, - is_literal as is_literal, - is_named_tuple as is_named_tuple, - is_new_type as is_new_type, - is_optional as is_optional, - is_special_typing_primitive as is_special_typing_primitive, - is_type_var as is_type_var, - is_type_var_any as is_type_var_any, - is_typed_dict as is_typed_dict, - is_union as is_union, - not_none_type_arg as not_none_type_arg, - resolve_type_vars as resolve_type_vars, - type_name as type_name, -) -from mashumaro.core.meta.patch import patch_fromisoformat as patch_fromisoformat -from mashumaro.dialect import Dialect as Dialect -from mashumaro.exceptions import ( - BadDialect as BadDialect, - BadHookSignature as BadHookSignature, - InvalidFieldValue as InvalidFieldValue, - MissingField as MissingField, - ThirdPartyModuleNotFoundError as ThirdPartyModuleNotFoundError, - UnresolvedTypeReferenceError as UnresolvedTypeReferenceError, - UnserializableDataError as UnserializableDataError, - UnserializableField as UnserializableField, - UnsupportedDeserializationEngine as UnsupportedDeserializationEngine, - UnsupportedSerializationEngine as UnsupportedSerializationEngine, -) -from mashumaro.helper import pass_through as pass_through -from mashumaro.types import ( - GenericSerializableType as GenericSerializableType, - SerializableType as SerializableType, - SerializationStrategy as SerializationStrategy, -) -from typing import Any - -NoneType: Any -__PRE_SERIALIZE__: str -__PRE_DESERIALIZE__: str -__POST_SERIALIZE__: str -__POST_DESERIALIZE__: str - -class CodeLines: - def __init__(self) -> None: ... - def append(self, line: str) -> None: ... - def indent(self) -> typing.Generator[None, None, None]: ... - def as_text(self) -> str: ... - def reset(self) -> None: ... - -class CodeBuilder: - cls: Any = ... - lines: Any = ... - globals: Any = ... - type_vars: Any = ... - field_classes: Any = ... - initial_arg_types: Any = ... - dialect: Any = ... - allow_postponed_evaluation: Any = ... - def __init__( - self, - cls: Any, - arg_types: typing.Tuple = ..., - dialect: typing.Optional[typing.Type[Dialect]] = ..., - first_method: str = ..., - allow_postponed_evaluation: bool = ..., - ) -> None: ... - def reset(self) -> None: ... - @property - def namespace(self) -> typing.Dict[typing.Any, typing.Any]: ... - @property - def annotations(self) -> typing.Dict[str, typing.Any]: ... - @property - def field_types(self) -> typing.Dict[str, typing.Any]: ... - @property - def dataclass_fields(self) -> typing.Dict[str, Field]: ... - @property - def metadatas(self) -> typing.Dict[str, typing.Mapping[str, typing.Any]]: ... - def get_field_default(self, name: str) -> typing.Any: ... - def ensure_module_imported(self, module: types.ModuleType) -> None: ... - def add_line(self, line: str) -> None: ... - def indent(self) -> typing.Generator[None, None, None]: ... - def compile(self) -> None: ... - def get_declared_hook(self, method_name: str) -> typing.Any: ... - def add_from_dict(self) -> None: ... - def get_config(self, cls: Any = ...) -> typing.Type[BaseConfig]: ... - def get_to_dict_flags(self, cls: Any = ...) -> str: ... - def get_from_dict_flags(self, cls: Any = ...) -> str: ... - def get_to_dict_default_flag_values(self, cls: Any = ...) -> str: ... - def get_from_dict_default_flag_values(self, cls: Any = ...) -> str: ... - def is_code_generation_option_enabled(self, option: str, cls: Any = ...) -> bool: ... - def add_to_dict(self) -> None: ... diff --git a/third-party-stubs/mashumaro/dialects/__init__.pyi b/third-party-stubs/mashumaro/core/meta/code/__init__.pyi similarity index 100% rename from third-party-stubs/mashumaro/dialects/__init__.pyi rename to third-party-stubs/mashumaro/core/meta/code/__init__.pyi diff --git a/third-party-stubs/mashumaro/core/meta/code/builder.pyi b/third-party-stubs/mashumaro/core/meta/code/builder.pyi new file mode 100644 index 00000000000..9d575b79467 --- /dev/null +++ b/third-party-stubs/mashumaro/core/meta/code/builder.pyi @@ -0,0 +1,146 @@ +import types +import typing +from _typeshed import Incomplete +from collections.abc import Generator +from dataclasses import Field +from mashumaro.config import ( + ADD_DIALECT_SUPPORT as ADD_DIALECT_SUPPORT, + ADD_SERIALIZATION_CONTEXT as ADD_SERIALIZATION_CONTEXT, + BaseConfig as BaseConfig, + SerializationStrategyValueType as SerializationStrategyValueType, + TO_DICT_ADD_BY_ALIAS_FLAG as TO_DICT_ADD_BY_ALIAS_FLAG, + TO_DICT_ADD_OMIT_NONE_FLAG as TO_DICT_ADD_OMIT_NONE_FLAG, +) +from mashumaro.core.const import Sentinel as Sentinel +from mashumaro.core.helpers import ConfigValue as ConfigValue +from mashumaro.core.meta.code.lines import CodeLines as CodeLines +from mashumaro.core.meta.helpers import ( + get_args as get_args, + get_class_that_defines_field as get_class_that_defines_field, + get_class_that_defines_method as get_class_that_defines_method, + get_literal_values as get_literal_values, + get_name_error_name as get_name_error_name, + hash_type_args as hash_type_args, + is_class_var as is_class_var, + is_dataclass_dict_mixin as is_dataclass_dict_mixin, + is_dialect_subclass as is_dialect_subclass, + is_init_var as is_init_var, + is_literal as is_literal, + is_optional as is_optional, + is_type_var_any as is_type_var_any, + resolve_type_params as resolve_type_params, + substitute_type_params as substitute_type_params, + type_name as type_name, +) +from mashumaro.core.meta.types.common import FieldContext as FieldContext, ValueSpec as ValueSpec +from mashumaro.core.meta.types.pack import PackerRegistry as PackerRegistry +from mashumaro.core.meta.types.unpack import ( + SubtypeUnpackerBuilder as SubtypeUnpackerBuilder, + UnpackerRegistry as UnpackerRegistry, +) +from mashumaro.dialect import Dialect as Dialect +from mashumaro.exceptions import ( + BadDialect as BadDialect, + BadHookSignature as BadHookSignature, + InvalidFieldValue as InvalidFieldValue, + MissingDiscriminatorError as MissingDiscriminatorError, + MissingField as MissingField, + SuitableVariantNotFoundError as SuitableVariantNotFoundError, + ThirdPartyModuleNotFoundError as ThirdPartyModuleNotFoundError, + UnresolvedTypeReferenceError as UnresolvedTypeReferenceError, + UnserializableDataError as UnserializableDataError, + UnserializableField as UnserializableField, + UnsupportedDeserializationEngine as UnsupportedDeserializationEngine, + UnsupportedSerializationEngine as UnsupportedSerializationEngine, +) +from mashumaro.types import Discriminator as Discriminator + +__PRE_SERIALIZE__: str +__PRE_DESERIALIZE__: str +__POST_SERIALIZE__: str +__POST_DESERIALIZE__: str + +class CodeBuilder: + cls: Incomplete + lines: Incomplete + globals: Incomplete + resolved_type_params: Incomplete + field_classes: Incomplete + initial_type_args: Incomplete + dialect: Incomplete + default_dialect: Incomplete + allow_postponed_evaluation: Incomplete + format_name: Incomplete + decoder: Incomplete + encoder: Incomplete + encoder_kwargs: Incomplete + def __init__( + self, + cls: typing.Type, + type_args: typing.Tuple[typing.Type, ...] = ..., + dialect: typing.Optional[typing.Type[Dialect]] = ..., + first_method: str = ..., + allow_postponed_evaluation: bool = ..., + format_name: str = ..., + decoder: typing.Optional[typing.Any] = ..., + encoder: typing.Optional[typing.Any] = ..., + encoder_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = ..., + default_dialect: typing.Optional[typing.Type[Dialect]] = ..., + ) -> None: ... + def reset(self) -> None: ... + @property + def namespace(self) -> typing.Mapping[typing.Any, typing.Any]: ... + @property + def annotations(self) -> typing.Dict[str, typing.Any]: ... + def get_field_resolved_type_params( + self, field_name: str + ) -> typing.Dict[typing.Type, typing.Type]: ... + def get_field_types(self, include_extras: bool = ...) -> typing.Dict[str, typing.Any]: ... + @property + def dataclass_fields(self) -> typing.Dict[str, Field]: ... + @property + def metadatas(self) -> typing.Dict[str, typing.Mapping[str, typing.Any]]: ... + def get_field_default(self, name: str) -> typing.Any: ... + def add_type_modules(self, *types_: typing.Type) -> None: ... + def ensure_module_imported(self, module: types.ModuleType) -> None: ... + def ensure_object_imported( + self, obj: typing.Any, name: typing.Optional[str] = ... + ) -> None: ... + def add_line(self, line: str) -> None: ... + def indent(self, expr: typing.Optional[str] = ...) -> typing.Generator[None, None, None]: ... + def compile(self) -> None: ... + def get_declared_hook(self, method_name: str) -> typing.Any: ... + def add_unpack_method(self) -> None: ... + def get_config(self, cls: Incomplete | None = ..., look_in_parents: bool = ...): ... + def get_discriminator(self) -> typing.Optional[Discriminator]: ... + def get_pack_method_flags( + self, cls: typing.Optional[typing.Type] = ..., pass_encoder: bool = ... + ) -> str: ... + def get_unpack_method_flags( + self, cls: typing.Optional[typing.Type] = ..., pass_decoder: bool = ... + ) -> str: ... + def get_pack_method_default_flag_values( + self, cls: typing.Optional[typing.Type] = ..., pass_encoder: bool = ... + ) -> str: ... + def get_unpack_method_default_flag_values(self, pass_decoder: bool = ...) -> str: ... + def is_code_generation_option_enabled( + self, option: str, cls: typing.Optional[typing.Type] = ... + ) -> bool: ... + @classmethod + def get_unpack_method_name( + cls, + type_args: typing.Iterable = ..., + format_name: str = ..., + decoder: typing.Optional[typing.Any] = ..., + ) -> str: ... + @classmethod + def get_pack_method_name( + cls, + type_args: typing.Tuple[typing.Type, ...] = ..., + format_name: str = ..., + encoder: typing.Optional[typing.Any] = ..., + ) -> str: ... + def add_pack_method(self) -> None: ... + def iter_serialization_strategies( + self, metadata, ftype + ) -> Generator[Incomplete, None, None]: ... diff --git a/third-party-stubs/mashumaro/core/meta/code/lines.pyi b/third-party-stubs/mashumaro/core/meta/code/lines.pyi new file mode 100644 index 00000000000..4d9bf5039c7 --- /dev/null +++ b/third-party-stubs/mashumaro/core/meta/code/lines.pyi @@ -0,0 +1,8 @@ +from typing import Generator, Optional + +class CodeLines: + def __init__(self) -> None: ... + def append(self, line: str) -> None: ... + def indent(self, expr: Optional[str] = ...) -> Generator[None, None, None]: ... + def as_text(self) -> str: ... + def reset(self) -> None: ... diff --git a/third-party-stubs/mashumaro/core/meta/helpers.pyi b/third-party-stubs/mashumaro/core/meta/helpers.pyi index 112a5a078ba..7ec3124e0ac 100644 --- a/third-party-stubs/mashumaro/core/meta/helpers.pyi +++ b/third-party-stubs/mashumaro/core/meta/helpers.pyi @@ -1,37 +1,58 @@ import typing -from typing import Any +from typing import Any, Dict, Optional, Sequence, Tuple, Type -def get_type_origin(t: Any): ... -def get_generic_name(t: Any, short: bool = ...) -> str: ... -def get_args(t: typing.Any) -> typing.Tuple[typing.Any, ...]: ... -def get_literal_values(t: typing.Any) -> Any: ... +def get_type_origin(typ: Type) -> Type: ... +def get_generic_name(typ: Type, short: bool = ...) -> str: ... +def get_args(typ: Optional[Type]) -> Tuple[Type, ...]: ... +def get_literal_values(typ: Type) -> Tuple[Any, ...]: ... def type_name( - t: typing.Any, + typ: Optional[Type], short: bool = ..., - type_vars: typing.Dict[str, typing.Any] = ..., + resolved_type_params: Optional[Dict[Type, Type]] = ..., is_type_origin: bool = ..., none_type_as_none: bool = ..., ) -> str: ... -def is_special_typing_primitive(t: Any) -> bool: ... -def is_generic(t: Any): ... -def is_typed_dict(t: Any) -> bool: ... -def is_named_tuple(t: Any) -> bool: ... -def is_new_type(t: Any) -> bool: ... -def is_union(t: Any): ... -def is_optional(t: Any, type_vars: typing.Dict[str, typing.Any] = ...) -> bool: ... -def is_annotated(t: Any) -> bool: ... -def is_literal(t: Any) -> bool: ... +def is_special_typing_primitive(typ: Any) -> bool: ... +def is_generic(typ: Type) -> bool: ... +def is_typed_dict(typ: Type) -> bool: ... +def is_named_tuple(typ: Type) -> bool: ... +def is_new_type(typ: Type) -> bool: ... +def is_union(typ: Type) -> bool: ... +def is_optional(typ: Type, resolved_type_params: Optional[Dict[Type, Type]] = ...) -> bool: ... +def is_annotated(typ: Type) -> bool: ... +def get_type_annotations(typ: Type) -> Sequence[Any]: ... +def is_literal(typ: Type) -> bool: ... def not_none_type_arg( - args: typing.Tuple[typing.Any, ...], type_vars: typing.Dict[str, typing.Any] = ... -) -> Any: ... -def is_type_var(t: Any) -> bool: ... -def is_type_var_any(t: Any) -> bool: ... -def is_class_var(t: Any) -> bool: ... -def is_init_var(t: Any) -> bool: ... -def get_class_that_defines_method(method_name: Any, cls: Any): ... -def get_class_that_defines_field(field_name: Any, cls: Any): ... -def is_dataclass_dict_mixin(t: Any) -> bool: ... -def is_dataclass_dict_mixin_subclass(t: Any) -> bool: ... -def resolve_type_vars(cls, arg_types: Any = ..., is_cls_created: bool = ...): ... + type_args: Tuple[Type, ...], resolved_type_params: Optional[Dict[Type, Type]] = ... +) -> Optional[Type]: ... +def is_type_var(typ: Type) -> bool: ... +def is_type_var_any(typ: Type) -> bool: ... +def is_class_var(typ: Type) -> bool: ... +def is_final(typ: Type) -> bool: ... +def is_init_var(typ: Type) -> bool: ... +def get_class_that_defines_method(method_name: str, cls: Type) -> Optional[Type]: ... +def get_class_that_defines_field(field_name: str, cls: Type) -> Optional[Type]: ... +def is_dataclass_dict_mixin(typ: Type) -> bool: ... +def is_dataclass_dict_mixin_subclass(typ: Type) -> bool: ... +def collect_type_params(typ: Type) -> Sequence[Type]: ... +def resolve_type_params( + typ: Type, type_args: Sequence[Type] = ..., include_bases: bool = ... +) -> Dict[Type, Dict[Type, Type]]: ... +def substitute_type_params(typ: Type, substitutions: Dict[Type, Type]) -> Type: ... def get_name_error_name(e: NameError) -> str: ... -def is_dialect_subclass(t: Any) -> bool: ... +def is_dialect_subclass(typ: Type) -> bool: ... +def is_self(typ: Type) -> bool: ... +def is_required(typ: Type) -> bool: ... +def is_not_required(typ: Type) -> bool: ... +def get_function_arg_annotation( + function: typing.Callable[[Any], Any], + arg_name: typing.Optional[str] = ..., + arg_pos: typing.Optional[int] = ..., +) -> typing.Type: ... +def get_function_return_annotation( + function: typing.Callable[[typing.Any], typing.Any] +) -> typing.Type: ... +def is_unpack(typ: Type) -> bool: ... +def is_type_var_tuple(typ: Type) -> bool: ... +def hash_type_args(type_args: typing.Iterable[typing.Type]) -> str: ... +def iter_all_subclasses(cls) -> typing.Iterator[Type]: ... diff --git a/third-party-stubs/mashumaro/core/meta/mixin.pyi b/third-party-stubs/mashumaro/core/meta/mixin.pyi new file mode 100644 index 00000000000..1d6734e0663 --- /dev/null +++ b/third-party-stubs/mashumaro/core/meta/mixin.pyi @@ -0,0 +1,13 @@ +from mashumaro.dialect import Dialect +from typing import Any, Dict, Optional, Tuple, Type + +def compile_mixin_packer( + cls, + format_name: str = ..., + dialect: Optional[Type[Dialect]] = ..., + encoder: Any = ..., + encoder_kwargs: Optional[Dict[str, Dict[str, Tuple[str, Any]]]] = ..., +) -> None: ... +def compile_mixin_unpacker( + cls, format_name: str = ..., dialect: Optional[Type[Dialect]] = ..., decoder: Any = ... +) -> None: ... diff --git a/third-party-stubs/mashumaro/core/meta/patch.pyi b/third-party-stubs/mashumaro/core/meta/patch.pyi deleted file mode 100644 index d3fa7446eb6..00000000000 --- a/third-party-stubs/mashumaro/core/meta/patch.pyi +++ /dev/null @@ -1 +0,0 @@ -def patch_fromisoformat() -> None: ... diff --git a/third-party-stubs/mashumaro/core/meta/types/__init__.pyi b/third-party-stubs/mashumaro/core/meta/types/__init__.pyi new file mode 100644 index 00000000000..e69de29bb2d diff --git a/third-party-stubs/mashumaro/core/meta/types/common.pyi b/third-party-stubs/mashumaro/core/meta/types/common.pyi new file mode 100644 index 00000000000..68ced55372e --- /dev/null +++ b/third-party-stubs/mashumaro/core/meta/types/common.pyi @@ -0,0 +1,67 @@ +from _typeshed import Incomplete +from functools import cached_property +from mashumaro.core.const import PEP_585_COMPATIBLE as PEP_585_COMPATIBLE +from mashumaro.core.meta.code.builder import CodeBuilder as CodeBuilder +from mashumaro.core.meta.helpers import ( + get_type_origin as get_type_origin, + is_annotated as is_annotated, + is_generic as is_generic, + type_name as type_name, +) +from mashumaro.exceptions import ( + UnserializableDataError as UnserializableDataError, + UnserializableField as UnserializableField, +) +from typing import Any, Dict, Mapping, Optional, Sequence, Type, TypeVar +from typing_extensions import TypeAlias + +cached_property = property +NoneType: Incomplete +Expression: TypeAlias +P: Incomplete +T = TypeVar("T") + +class ExpressionWrapper: + expression: Incomplete + def __init__(self, expression: str) -> None: ... + +PROPER_COLLECTION_TYPES: Dict[Type, str] + +class FieldContext: + name: str + metadata: Mapping + def copy(self, **changes: Any) -> FieldContext: ... + def __init__(self, name, metadata) -> None: ... + +class ValueSpec: + type: Type + origin_type: Type + expression: Expression + builder: CodeBuilder + field_ctx: FieldContext + could_be_none: bool + annotated_type: Optional[Type] + def __setattr__(self, key: str, value: Any) -> None: ... + def copy(self, **changes: Any) -> ValueSpec: ... + @cached_property + def annotations(self) -> Sequence[str]: ... + def __init__( + self, type, expression, builder, field_ctx, could_be_none, annotated_type + ) -> None: ... + +ValueSpecExprCreator: TypeAlias + +class Registry: + def register(self, function: ValueSpecExprCreator) -> ValueSpecExprCreator: ... + def get(self, spec: ValueSpec) -> Expression: ... + def __init__(self, _registry) -> None: ... + +def ensure_generic_collection(spec: ValueSpec) -> bool: ... +def ensure_collection_type_args_supported( + collection_type: Type, type_args: Sequence[Type] +) -> bool: ... +def ensure_generic_collection_subclass(spec: ValueSpec, *checked_types: Type) -> bool: ... +def ensure_generic_mapping(spec: ValueSpec, args: Sequence[Type], checked_type: Type) -> bool: ... +def expr_or_maybe_none(spec: ValueSpec, new_expr: Expression) -> Expression: ... +def random_hex() -> str: ... +def clean_id(value: str) -> str: ... diff --git a/third-party-stubs/mashumaro/core/meta/types/pack.pyi b/third-party-stubs/mashumaro/core/meta/types/pack.pyi new file mode 100644 index 00000000000..3231d8873f0 --- /dev/null +++ b/third-party-stubs/mashumaro/core/meta/types/pack.pyi @@ -0,0 +1,3 @@ +from _typeshed import Incomplete + +PackerRegistry: Incomplete diff --git a/third-party-stubs/mashumaro/core/meta/types/unpack.pyi b/third-party-stubs/mashumaro/core/meta/types/unpack.pyi new file mode 100644 index 00000000000..47020521425 --- /dev/null +++ b/third-party-stubs/mashumaro/core/meta/types/unpack.pyi @@ -0,0 +1,34 @@ +import abc +from _typeshed import Incomplete +from abc import ABC, abstractmethod +from mashumaro.core.meta.types.common import ValueSpec +from mashumaro.types import Discriminator +from typing import Optional, Tuple, Type + +UnpackerRegistry: Incomplete + +class AbstractUnpackerBuilder(ABC, metaclass=abc.ABCMeta): + @abstractmethod + def get_method_prefix(self) -> str: ... + def build(self, spec: ValueSpec) -> str: ... + +class UnionUnpackerBuilder(AbstractUnpackerBuilder): + union_args: Incomplete + def __init__(self, args: Tuple[Type, ...]) -> None: ... + def get_method_prefix(self) -> str: ... + +class TypeVarUnpackerBuilder(UnionUnpackerBuilder): + def get_method_prefix(self) -> str: ... + +class LiteralUnpackerBuilder(AbstractUnpackerBuilder): + def get_method_prefix(self) -> str: ... + +class DiscriminatedUnionUnpackerBuilder(AbstractUnpackerBuilder): + discriminator: Incomplete + base_variants: Incomplete + def __init__( + self, discriminator: Discriminator, base_variants: Optional[Tuple[Type, ...]] = ... + ) -> None: ... + def get_method_prefix(self) -> str: ... + +class SubtypeUnpackerBuilder(DiscriminatedUnionUnpackerBuilder): ... diff --git a/third-party-stubs/mashumaro/dialect.pyi b/third-party-stubs/mashumaro/dialect.pyi index 330c9cfa1c1..3f93bcfa2ce 100644 --- a/third-party-stubs/mashumaro/dialect.pyi +++ b/third-party-stubs/mashumaro/dialect.pyi @@ -1,7 +1,10 @@ +from mashumaro.core.const import Sentinel from mashumaro.types import SerializationStrategy -from typing import Any, Callable, Dict, Union +from typing import Callable, Dict, Union +from typing_extensions import Literal SerializationStrategyValueType = Union[SerializationStrategy, Dict[str, Union[str, Callable]]] class Dialect: - serialization_strategy: Dict[Any, SerializationStrategyValueType] = ... + serialization_strategy: Dict[str, SerializationStrategyValueType] + omit_none: Union[bool, Sentinel.MISSING] diff --git a/third-party-stubs/mashumaro/dialects/msgpack.pyi b/third-party-stubs/mashumaro/dialects/msgpack.pyi deleted file mode 100644 index f28b7c38283..00000000000 --- a/third-party-stubs/mashumaro/dialects/msgpack.pyi +++ /dev/null @@ -1,5 +0,0 @@ -from mashumaro.dialect import Dialect -from typing import Any - -class MessagePackDialect(Dialect): - serialization_strategy: Any = ... diff --git a/third-party-stubs/mashumaro/exceptions.pyi b/third-party-stubs/mashumaro/exceptions.pyi index 093eb7aa71f..d4c536a2b20 100644 --- a/third-party-stubs/mashumaro/exceptions.pyi +++ b/third-party-stubs/mashumaro/exceptions.pyi @@ -1,75 +1,91 @@ +from _typeshed import Incomplete from mashumaro.core.meta.helpers import type_name as type_name -from typing import Any, Optional +from typing import Any, Optional, Type class MissingField(LookupError): - field_name: Any = ... - field_type: Any = ... - holder_class: Any = ... - def __init__(self, field_name: Any, field_type: Any, holder_class: Any) -> None: ... + field_name: Incomplete + field_type: Incomplete + holder_class: Incomplete + def __init__(self, field_name: str, field_type: Type, holder_class: Type) -> None: ... @property - def field_type_name(self): ... + def field_type_name(self) -> str: ... @property - def holder_class_name(self): ... + def holder_class_name(self) -> str: ... class UnserializableDataError(TypeError): ... class UnserializableField(UnserializableDataError): - field_name: Any = ... - field_type: Any = ... - holder_class: Any = ... - msg: Any = ... + field_name: Incomplete + field_type: Incomplete + holder_class: Incomplete + msg: Incomplete def __init__( - self, field_name: Any, field_type: Any, holder_class: Any, msg: Optional[Any] = ... + self, field_name: str, field_type: Type, holder_class: Type, msg: Optional[str] = ... ) -> None: ... @property - def field_type_name(self): ... + def field_type_name(self) -> str: ... @property - def holder_class_name(self): ... + def holder_class_name(self) -> str: ... class UnsupportedSerializationEngine(UnserializableField): def __init__( - self, field_name: Any, field_type: Any, holder_class: Any, engine: Any + self, field_name: str, field_type: Type, holder_class: Type, engine: Any ) -> None: ... class UnsupportedDeserializationEngine(UnserializableField): def __init__( - self, field_name: Any, field_type: Any, holder_class: Any, engine: Any + self, field_name: str, field_type: Type, holder_class: Type, engine: Any ) -> None: ... class InvalidFieldValue(ValueError): - field_name: Any = ... - field_type: Any = ... - field_value: Any = ... - holder_class: Any = ... - msg: Any = ... + field_name: Incomplete + field_type: Incomplete + field_value: Incomplete + holder_class: Incomplete + msg: Incomplete def __init__( self, - field_name: Any, - field_type: Any, + field_name: str, + field_type: Type, field_value: Any, - holder_class: Any, - msg: Optional[Any] = ..., + holder_class: Type, + msg: Optional[str] = ..., ) -> None: ... @property - def field_type_name(self): ... + def field_type_name(self) -> str: ... @property - def holder_class_name(self): ... + def holder_class_name(self) -> str: ... + +class MissingDiscriminatorError(LookupError): + field_name: Incomplete + def __init__(self, field_name: str) -> None: ... + +class SuitableVariantNotFoundError(ValueError): + variants_type: Incomplete + discriminator_name: Incomplete + discriminator_value: Incomplete + def __init__( + self, + variants_type: Type, + discriminator_name: Optional[str] = ..., + discriminator_value: Any = ..., + ) -> None: ... class BadHookSignature(TypeError): ... class ThirdPartyModuleNotFoundError(ModuleNotFoundError): - module_name: Any = ... - field_name: Any = ... - holder_class: Any = ... - def __init__(self, module_name: Any, field_name: Any, holder_class: Any) -> None: ... + module_name: Incomplete + field_name: Incomplete + holder_class: Incomplete + def __init__(self, module_name: str, field_name: str, holder_class: Type) -> None: ... @property - def holder_class_name(self): ... + def holder_class_name(self) -> str: ... class UnresolvedTypeReferenceError(NameError): - holder_class: Any = ... - name: Any = ... - def __init__(self, holder_class: Any, unresolved_type_name: Any) -> None: ... + holder_class: Incomplete + name: Incomplete + def __init__(self, holder_class: Type, unresolved_type_name: str) -> None: ... @property - def holder_class_name(self): ... + def holder_class_name(self) -> str: ... class BadDialect(ValueError): ... diff --git a/third-party-stubs/mashumaro/helper.pyi b/third-party-stubs/mashumaro/helper.pyi index acc7c6b50b3..0eb8254dd27 100644 --- a/third-party-stubs/mashumaro/helper.pyi +++ b/third-party-stubs/mashumaro/helper.pyi @@ -1,5 +1,5 @@ from mashumaro.types import SerializationStrategy -from typing import Any, Callable, Optional, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union from typing_extensions import Literal NamedTupleDeserializationEngine = Literal["as_dict", "as_list"] @@ -7,18 +7,21 @@ DateTimeDeserializationEngine = Literal["ciso8601", "pendulum"] AnyDeserializationEngine = Literal[NamedTupleDeserializationEngine, DateTimeDeserializationEngine] NamedTupleSerializationEngine = Literal["as_dict", "as_list"] -AnySerializationEngine = NamedTupleSerializationEngine +AnySerializationEngine = Union[NamedTupleSerializationEngine, OmitSerializationEngine] +OmitSerializationEngine = Literal["omit"] + +T = TypeVar("T") def field_options( serialize: Optional[Union[AnySerializationEngine, Callable[[Any], Any]]] = ..., deserialize: Optional[Union[AnyDeserializationEngine, Callable[[Any], Any]]] = ..., serialization_strategy: Optional[SerializationStrategy] = ..., alias: Optional[str] = ..., -) -> Any: ... +) -> Dict[str, Any]: ... class _PassThrough(SerializationStrategy): - def __call__(self, *args: Any, **kwargs: Any) -> None: ... - def serialize(self, value: Any): ... - def deserialize(self, value: Any): ... + def __call__(self, *args: Any, **kwargs: Any) -> Any: ... + def serialize(self, value: T) -> T: ... + def deserialize(self, value: T) -> T: ... pass_through: Any diff --git a/third-party-stubs/mashumaro/jsonschema/__init__.pyi b/third-party-stubs/mashumaro/jsonschema/__init__.pyi new file mode 100644 index 00000000000..9c6436c675e --- /dev/null +++ b/third-party-stubs/mashumaro/jsonschema/__init__.pyi @@ -0,0 +1,2 @@ +from .builder import JSONSchemaBuilder as JSONSchemaBuilder, build_json_schema as build_json_schema +from .dialects import DRAFT_2020_12 as DRAFT_2020_12, OPEN_API_3_1 as OPEN_API_3_1 diff --git a/third-party-stubs/mashumaro/jsonschema/annotations.pyi b/third-party-stubs/mashumaro/jsonschema/annotations.pyi new file mode 100644 index 00000000000..f39d8003626 --- /dev/null +++ b/third-party-stubs/mashumaro/jsonschema/annotations.pyi @@ -0,0 +1,80 @@ +from mashumaro.jsonschema.models import JSONSchema, Number +from typing import Dict, Set + +class Annotation: ... +class Constraint(Annotation): ... +class NumberConstraint(Constraint): ... + +class Minimum(NumberConstraint): + value: Number + def __init__(self, value) -> None: ... + +class Maximum(NumberConstraint): + value: Number + def __init__(self, value) -> None: ... + +class ExclusiveMinimum(NumberConstraint): + value: Number + def __init__(self, value) -> None: ... + +class ExclusiveMaximum(NumberConstraint): + value: Number + def __init__(self, value) -> None: ... + +class MultipleOf(NumberConstraint): + value: Number + def __init__(self, value) -> None: ... + +class StringConstraint(Constraint): ... + +class MinLength(StringConstraint): + value: int + def __init__(self, value) -> None: ... + +class MaxLength(StringConstraint): + value: int + def __init__(self, value) -> None: ... + +class Pattern(StringConstraint): + value: str + def __init__(self, value) -> None: ... + +class ArrayConstraint(Constraint): ... + +class MinItems(ArrayConstraint): + value: int + def __init__(self, value) -> None: ... + +class MaxItems(ArrayConstraint): + value: int + def __init__(self, value) -> None: ... + +class UniqueItems(ArrayConstraint): + value: bool + def __init__(self, value) -> None: ... + +class Contains(ArrayConstraint): + value: JSONSchema + def __init__(self, value) -> None: ... + +class MinContains(ArrayConstraint): + value: int + def __init__(self, value) -> None: ... + +class MaxContains(ArrayConstraint): + value: int + def __init__(self, value) -> None: ... + +class ObjectConstraint(Constraint): ... + +class MaxProperties(ObjectConstraint): + value: int + def __init__(self, value) -> None: ... + +class MinProperties(ObjectConstraint): + value: int + def __init__(self, value) -> None: ... + +class DependentRequired(ObjectConstraint): + value: Dict[str, Set[str]] + def __init__(self, value) -> None: ... diff --git a/third-party-stubs/mashumaro/jsonschema/builder.pyi b/third-party-stubs/mashumaro/jsonschema/builder.pyi new file mode 100644 index 00000000000..98bbc860298 --- /dev/null +++ b/third-party-stubs/mashumaro/jsonschema/builder.pyi @@ -0,0 +1,31 @@ +from _typeshed import Incomplete +from mashumaro.jsonschema.dialects import JSONSchemaDialect +from mashumaro.jsonschema.models import Context, JSONSchema +from mashumaro.mixins.json import DataClassJSONMixin +from typing import Any, Dict, List, Optional, Type + +def build_json_schema( + instance_type: Type, + context: Optional[Context] = ..., + with_definitions: bool = ..., + all_refs: Optional[bool] = ..., + with_dialect_uri: bool = ..., + dialect: Optional[JSONSchemaDialect] = ..., + ref_prefix: Optional[str] = ..., +) -> JSONSchema: ... + +class JSONSchemaDefinitions(DataClassJSONMixin): + definitions: Dict[str, JSONSchema] + def __post_serialize__(self, d: Dict[Any, Any]) -> List[Dict[str, Any]]: ... # type: ignore + def __init__(self, definitions) -> None: ... + +class JSONSchemaBuilder: + context: Incomplete + def __init__( + self, + dialect: JSONSchemaDialect = ..., + all_refs: Optional[bool] = ..., + ref_prefix: Optional[str] = ..., + ) -> None: ... + def build(self, instance_type: Type) -> JSONSchema: ... + def get_definitions(self) -> JSONSchemaDefinitions: ... diff --git a/third-party-stubs/mashumaro/jsonschema/dialects.pyi b/third-party-stubs/mashumaro/jsonschema/dialects.pyi new file mode 100644 index 00000000000..88af0707fa0 --- /dev/null +++ b/third-party-stubs/mashumaro/jsonschema/dialects.pyi @@ -0,0 +1,22 @@ +from _typeshed import Incomplete + +class JSONSchemaDialect: + uri: str + definitions_root_pointer: str + all_refs: bool + def __init__(self, uri, definitions_root_pointer, all_refs) -> None: ... + +class JSONSchemaDraft202012Dialect(JSONSchemaDialect): + uri: str + definitions_root_pointer: str + all_refs: bool + def __init__(self, uri, definitions_root_pointer, all_refs) -> None: ... + +class OpenAPISchema31Dialect(JSONSchemaDialect): + uri: str + definitions_root_pointer: str + all_refs: bool + def __init__(self, uri, definitions_root_pointer, all_refs) -> None: ... + +DRAFT_2020_12: Incomplete +OPEN_API_3_1: Incomplete diff --git a/third-party-stubs/mashumaro/jsonschema/models.pyi b/third-party-stubs/mashumaro/jsonschema/models.pyi new file mode 100644 index 00000000000..b67db67b20b --- /dev/null +++ b/third-party-stubs/mashumaro/jsonschema/models.pyi @@ -0,0 +1,243 @@ +from _typeshed import Incomplete +from enum import Enum +from mashumaro.config import BaseConfig as BaseConfig +from mashumaro.helper import pass_through as pass_through +from mashumaro.jsonschema.dialects import ( + DRAFT_2020_12 as DRAFT_2020_12, + JSONSchemaDialect as JSONSchemaDialect, +) +from mashumaro.mixins.json import DataClassJSONMixin as DataClassJSONMixin +from typing import Any, Dict, List, Optional, Set, Union +from typing_extensions import TypeAlias + +Number: TypeAlias = Union[int, float] +Null = object() + +class JSONSchemaInstanceType(Enum): + NULL: str + BOOLEAN: str + OBJECT: str + ARRAY: str + NUMBER: str + STRING: str + INTEGER: str + +class JSONSchemaInstanceFormat(Enum): ... + +class JSONSchemaStringFormat(JSONSchemaInstanceFormat): + DATETIME: str + DATE: str + TIME: str + DURATION: str + EMAIL: str + IDN_EMAIL: str + HOSTNAME: str + IDN_HOSTNAME: str + IPV4ADDRESS: str + IPV6ADDRESS: str + URI: str + URI_REFERENCE: str + IRI: str + IRI_REFERENCE: str + UUID: str + URI_TEMPLATE: str + JSON_POINTER: str + RELATIVE_JSON_POINTER: str + REGEX: str + +class JSONSchemaInstanceFormatExtension(JSONSchemaInstanceFormat): + TIMEDELTA: str + TIME_ZONE: str + IPV4NETWORK: str + IPV6NETWORK: str + IPV4INTERFACE: str + IPV6INTERFACE: str + DECIMAL: str + FRACTION: str + BASE64: str + PATH: str + +DATETIME_FORMATS: Incomplete +IPADDRESS_FORMATS: Incomplete + +class JSONSchema(DataClassJSONMixin): + schema: Optional[str] + type: Optional[JSONSchemaInstanceType] + enum: Optional[List[Any]] + const: Optional[Any] + format: Optional[ + Union[JSONSchemaInstanceFormat, JSONSchemaStringFormat, JSONSchemaInstanceFormatExtension] + ] + title: Optional[str] + description: Optional[str] + anyOf: Optional[List["JSONSchema"]] + reference: Optional[str] + definitions: Optional[Dict[str, "JSONSchema"]] + default: Optional[Any] + deprecated: Optional[bool] + examples: Optional[List[Any]] + properties: Optional[Dict[str, "JSONSchema"]] + patternProperties: Optional[Dict[str, "JSONSchema"]] + additionalProperties: Union["JSONSchema", bool, None] + propertyNames: Optional["JSONSchema"] + prefixItems: Optional[List["JSONSchema"]] + items: Optional["JSONSchema"] + contains: Optional["JSONSchema"] + multipleOf: Optional[Number] + maximum: Optional[Number] + exclusiveMaximum: Optional[Number] + minimum: Optional[Number] + exclusiveMinimum: Optional[Number] + maxLength: Optional[int] + minLength: Optional[int] + pattern: Optional[str] + maxItems: Optional[int] + minItems: Optional[int] + uniqueItems: Optional[bool] + maxContains: Optional[int] + minContains: Optional[int] + maxProperties: Optional[int] + minProperties: Optional[int] + required: Optional[List[str]] + dependentRequired: Optional[Dict[str, Set[str]]] + + class Config(BaseConfig): + omit_none: bool + serialize_by_alias: bool + aliases: Incomplete + serialization_strategy: Incomplete + def __pre_serialize__(self) -> JSONSchema: ... + def __post_serialize__(self, d: Dict[Any, Any]) -> Dict[Any, Any]: ... + def __init__( + self, + schema, + type, + enum, + const, + format, + title, + description, + anyOf, + reference, + definitions, + default, + deprecated, + examples, + properties, + patternProperties, + additionalProperties, + propertyNames, + prefixItems, + items, + contains, + multipleOf, + maximum, + exclusiveMaximum, + minimum, + exclusiveMinimum, + maxLength, + minLength, + pattern, + maxItems, + minItems, + uniqueItems, + maxContains, + minContains, + maxProperties, + minProperties, + required, + dependentRequired, + ) -> None: ... + +class JSONObjectSchema(JSONSchema): + type: JSONSchemaInstanceType + def __init__( + self, + schema, + type, + enum, + const, + format, + title, + description, + anyOf, + reference, + definitions, + default, + deprecated, + examples, + properties, + patternProperties, + additionalProperties, + propertyNames, + prefixItems, + items, + contains, + multipleOf, + maximum, + exclusiveMaximum, + minimum, + exclusiveMinimum, + maxLength, + minLength, + pattern, + maxItems, + minItems, + uniqueItems, + maxContains, + minContains, + maxProperties, + minProperties, + required, + dependentRequired, + ) -> None: ... + +class JSONArraySchema(JSONSchema): + type: JSONSchemaInstanceType + def __init__( + self, + schema, + type, + enum, + const, + format, + title, + description, + anyOf, + reference, + definitions, + default, + deprecated, + examples, + properties, + patternProperties, + additionalProperties, + propertyNames, + prefixItems, + items, + contains, + multipleOf, + maximum, + exclusiveMaximum, + minimum, + exclusiveMinimum, + maxLength, + minLength, + pattern, + maxItems, + minItems, + uniqueItems, + maxContains, + minContains, + maxProperties, + minProperties, + required, + dependentRequired, + ) -> None: ... + +class Context: + dialect: JSONSchemaDialect + definitions: Dict[str, JSONSchema] + all_refs: Optional[bool] + ref_prefix: Optional[str] + def __init__(self, dialect, definitions, all_refs, ref_prefix) -> None: ... diff --git a/third-party-stubs/mashumaro/jsonschema/schema.pyi b/third-party-stubs/mashumaro/jsonschema/schema.pyi new file mode 100644 index 00000000000..e3cd1b5cd19 --- /dev/null +++ b/third-party-stubs/mashumaro/jsonschema/schema.pyi @@ -0,0 +1,72 @@ +from mashumaro.config import BaseConfig +from mashumaro.jsonschema.annotations import Annotation +from mashumaro.jsonschema.models import Context, JSONSchema +from typing import Any, Callable, Iterable, List, Mapping, Optional, Tuple, Type, Union + +class Instance: + type: Type + name: Optional[str] + origin_type: Type + annotations: List[Annotation] + @property + def metadata(self) -> Mapping[str, Any]: ... + @property + def alias(self) -> Optional[str]: ... + @property + def holder_class(self) -> Optional[Type]: ... + def copy(self, **changes: Any) -> Instance: ... + def __post_init__(self) -> None: ... + def update_type(self, new_type: Type) -> None: ... + def fields(self) -> Iterable[Tuple[str, Type, bool, Any]]: ... + def get_overridden_serialization_method(self) -> Optional[Union[Callable, str]]: ... + def get_config(self) -> Type[BaseConfig]: ... + def __init__(self, type, name, __builder) -> None: ... + +class InstanceSchemaCreatorRegistry: + def register(self, func: InstanceSchemaCreator) -> InstanceSchemaCreator: ... + def iter(self) -> Iterable[InstanceSchemaCreator]: ... + def __init__(self, _registry) -> None: ... + +class EmptyJSONSchema(JSONSchema): + def __init__( + self, + schema, + type, + enum, + const, + format, + title, + description, + anyOf, + reference, + definitions, + default, + deprecated, + examples, + properties, + patternProperties, + additionalProperties, + propertyNames, + prefixItems, + items, + contains, + multipleOf, + maximum, + exclusiveMaximum, + minimum, + exclusiveMinimum, + maxLength, + minLength, + pattern, + maxItems, + minItems, + uniqueItems, + maxContains, + minContains, + maxProperties, + minProperties, + required, + dependentRequired, + ) -> None: ... + +def get_schema(instance: Instance, ctx: Context, with_dialect_uri: bool = ...) -> JSONSchema: ... diff --git a/third-party-stubs/mashumaro/mixins/dict.pyi b/third-party-stubs/mashumaro/mixins/dict.pyi index fb904b0e97c..877283960a9 100644 --- a/third-party-stubs/mashumaro/mixins/dict.pyi +++ b/third-party-stubs/mashumaro/mixins/dict.pyi @@ -4,9 +4,9 @@ T = TypeVar("T", bound="DataClassDictMixin") class DataClassDictMixin: def __init_subclass__(cls: Type[T], **kwargs: Any) -> None: ... - def to_dict(self, omit_none: bool = True, validate: bool = False) -> dict: ... + def to_dict(self, **kwargs: Any) -> dict: ... @classmethod - def from_dict(cls, d: Mapping, validate=True) -> Any: ... + def from_dict(cls, d: Mapping, **kwargs: Any) -> Any: ... @classmethod def __pre_deserialize__(cls: Type[T], d: Dict[Any, Any]) -> Dict[Any, Any]: ... @classmethod diff --git a/third-party-stubs/mashumaro/mixins/json.pyi b/third-party-stubs/mashumaro/mixins/json.pyi index 14066559f31..267c277e258 100644 --- a/third-party-stubs/mashumaro/mixins/json.pyi +++ b/third-party-stubs/mashumaro/mixins/json.pyi @@ -1,6 +1,5 @@ from mashumaro.mixins.dict import DataClassDictMixin as DataClassDictMixin -from typing import Any, Dict, Type, TypeVar, Union -from typing_extensions import Protocol as Protocol +from typing import Any, Callable, Dict, TypeVar, Union, Type EncodedData = Union[str, bytes, bytearray] T = TypeVar("T", bound="DataClassJSONMixin") diff --git a/third-party-stubs/mashumaro/mixins/msgpack.pyi b/third-party-stubs/mashumaro/mixins/msgpack.pyi index b75b35488a5..d1467bf4a79 100644 --- a/third-party-stubs/mashumaro/mixins/msgpack.pyi +++ b/third-party-stubs/mashumaro/mixins/msgpack.pyi @@ -1,17 +1,16 @@ -from mashumaro.dialects.msgpack import MessagePackDialect as MessagePackDialect +from _typeshed import Incomplete +from mashumaro.dialect import Dialect as Dialect +from mashumaro.helper import pass_through as pass_through from mashumaro.mixins.dict import DataClassDictMixin as DataClassDictMixin -from typing import Any, Dict, Type, TypeVar -from typing_extensions import Protocol as Protocol +from typing import Any, Callable, Dict, TypeVar, Type -EncodedData = bytes T = TypeVar("T", bound="DataClassMessagePackMixin") -DEFAULT_DICT_PARAMS: Any - -class Encoder: - def __call__(self, o: Any, **kwargs: Any) -> EncodedData: ... +EncodedData = bytes +Encoder = Callable[[Any], EncodedData] +Decoder = Callable[[EncodedData], Dict[Any, Any]] -class Decoder: - def __call__(self, packed: EncodedData, **kwargs: Any) -> Dict[Any, Any]: ... +class MessagePackDialect(Dialect): + serialization_strategy: Incomplete def default_encoder(data: Any) -> EncodedData: ... def default_decoder(data: EncodedData) -> Dict[Any, Any]: ... diff --git a/third-party-stubs/mashumaro/mixins/orjson.pyi b/third-party-stubs/mashumaro/mixins/orjson.pyi new file mode 100644 index 00000000000..d56f063e52b --- /dev/null +++ b/third-party-stubs/mashumaro/mixins/orjson.pyi @@ -0,0 +1,23 @@ +from mashumaro.dialect import Dialect as Dialect +from mashumaro.mixins.dict import DataClassDictMixin as DataClassDictMixin +from typing import Any, Callable, Dict, TypeVar, Union + +T = TypeVar("T", bound="DataClassORJSONMixin") +EncodedData = Union[str, bytes, bytearray] +Encoder = Callable[[Any], EncodedData] +Decoder = Callable[[EncodedData], Dict[Any, Any]] + +class OrjsonDialect(Dialect): + serialization_strategy: Any + +class DataClassORJSONMixin(DataClassDictMixin): + def to_jsonb( + self, encoder: Encoder = ..., *, orjson_options: int = ..., **to_dict_kwargs: Any + ) -> bytes: ... + def to_json( + self, encoder: Encoder = ..., *, orjson_options: int = ..., **to_dict_kwargs: Any + ) -> bytes: ... + @classmethod + def from_json( + cls, data: EncodedData, decoder: Decoder = ..., **from_dict_kwargs: Any + ) -> T: ... diff --git a/third-party-stubs/mashumaro/mixins/toml.pyi b/third-party-stubs/mashumaro/mixins/toml.pyi new file mode 100644 index 00000000000..bb56adee966 --- /dev/null +++ b/third-party-stubs/mashumaro/mixins/toml.pyi @@ -0,0 +1,21 @@ +from _typeshed import Incomplete +from mashumaro.dialect import Dialect as Dialect +from mashumaro.helper import pass_through as pass_through +from mashumaro.mixins.dict import DataClassDictMixin as DataClassDictMixin +from typing import Any, Callable, Dict, TypeVar + +T = TypeVar("T", bound="DataClassTOMLMixin") +EncodedData = str +Encoder = Callable[[Any], EncodedData] +Decoder = Callable[[EncodedData], Dict[Any, Any]] + +class TOMLDialect(Dialect): + omit_none: bool + serialization_strategy: Incomplete + +class DataClassTOMLMixin(DataClassDictMixin): + def to_toml(self, encoder: Encoder = ..., **to_dict_kwargs: Any) -> EncodedData: ... + @classmethod + def from_toml( + cls, data: EncodedData, decoder: Decoder = ..., **from_dict_kwargs: Any + ) -> T: ... diff --git a/third-party-stubs/mashumaro/mixins/yaml.pyi b/third-party-stubs/mashumaro/mixins/yaml.pyi index 4033741163b..25e3571bbbb 100644 --- a/third-party-stubs/mashumaro/mixins/yaml.pyi +++ b/third-party-stubs/mashumaro/mixins/yaml.pyi @@ -1,18 +1,13 @@ +from _typeshed import Incomplete from mashumaro.mixins.dict import DataClassDictMixin as DataClassDictMixin -from typing import Any, Dict, Type, TypeVar, Union -from typing_extensions import Protocol as Protocol +from typing import Any, Callable, Dict, TypeVar, Union -EncodedData = Union[str, bytes] T = TypeVar("T", bound="DataClassYAMLMixin") - -class Encoder: - def __call__(self, o: Any, **kwargs: Any) -> EncodedData: ... - -class Decoder: - def __call__(self, packed: EncodedData, **kwargs: Any) -> Dict[Any, Any]: ... - -DefaultLoader: Any -DefaultDumper: Any +EncodedData = Union[str, bytes] +Encoder = Callable[[Any], EncodedData] +Decoder = Callable[[EncodedData], Dict[Any, Any]] +DefaultLoader: Incomplete +DefaultDumper: Incomplete def default_encoder(data: Any) -> EncodedData: ... def default_decoder(data: EncodedData) -> Dict[Any, Any]: ... @@ -21,5 +16,5 @@ class DataClassYAMLMixin(DataClassDictMixin): def to_yaml(self, encoder: Encoder = ..., **to_dict_kwargs: Any) -> EncodedData: ... @classmethod def from_yaml( - cls: Type[T], data: EncodedData, decoder: Decoder = ..., **from_dict_kwargs: Any + cls, data: EncodedData, decoder: Decoder = ..., **from_dict_kwargs: Any ) -> T: ... diff --git a/third-party-stubs/mashumaro/types.pyi b/third-party-stubs/mashumaro/types.pyi index ca63363c51c..536c5d2c4c5 100644 --- a/third-party-stubs/mashumaro/types.pyi +++ b/third-party-stubs/mashumaro/types.pyi @@ -1,5 +1,8 @@ import decimal -from typing import Any, Optional +from _typeshed import Incomplete +from mashumaro.core.const import Sentinel +from typing import Any, Optional, Union +from typing_extensions import Literal class SerializableType: ... class GenericSerializableType: ... @@ -9,8 +12,15 @@ class SerializationStrategy: def deserialize(self, value: Any) -> Any: ... class RoundedDecimal(SerializationStrategy): - exp: Any = ... - rounding: Any = ... - def __init__(self, places: Optional[Any] = ..., rounding: Optional[Any] = ...) -> None: ... - def serialize(self, value: Any) -> str: ... - def deserialize(self, value: str) -> Any: ... + exp: Incomplete + rounding: Incomplete + def __init__(self, places: Optional[int] = ..., rounding: Optional[str] = ...) -> None: ... + def serialize(self, value: decimal.Decimal) -> str: ... + def deserialize(self, value: str) -> decimal.Decimal: ... + +class Discriminator: + field: Optional[str] + include_supertypes: bool + include_subtypes: bool + def __post_init__(self) -> None: ... + def __init__(self, field, include_supertypes, include_subtypes) -> None: ...