diff --git a/CHANGELOG.md b/CHANGELOG.md index 20828ba29a3..5912e917634 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,10 +2,12 @@ ### Features - Added a `full_refresh` config item that overrides the behavior of the `--full-refresh` flag ([#1009](https://github.com/fishtown-analytics/dbt/issues/1009), [#2348](https://github.com/fishtown-analytics/dbt/pull/2348)) +- Added a "docs" field to macros, with a "show" subfield to allow for hiding macros from the documentation site ([#2430](https://github.com/fishtown-analytics/dbt/issues/2430)) - Added intersection syntax for model selector ([#2167](https://github.com/fishtown-analytics/dbt/issues/2167), [#2417](https://github.com/fishtown-analytics/dbt/pull/2417)) Contributors: - [@raalsky](https://github.com/Raalsky) ([#2417](https://github.com/fishtown-analytics/dbt/pull/2417)) + - [@alf-mindshift](https://github.com/alf-mindshift) ([#2431](https://github.com/fishtown-analytics/dbt/pull/2431) ## dbt 0.17.0 (Release TBD) diff --git a/core/dbt/contracts/graph/parsed.py b/core/dbt/contracts/graph/parsed.py index efaff049810..d9433544a35 100644 --- a/core/dbt/contracts/graph/parsed.py +++ b/core/dbt/contracts/graph/parsed.py @@ -287,6 +287,7 @@ class ParsedMacro(UnparsedBaseNode, HasUniqueID): depends_on: MacroDependsOn = field(default_factory=MacroDependsOn) description: str = '' meta: Dict[str, Any] = field(default_factory=dict) + docs: Docs = field(default_factory=Docs) patch_path: Optional[str] = None arguments: List[MacroArgument] = field(default_factory=list) @@ -297,6 +298,7 @@ def patch(self, patch: ParsedMacroPatch): self.patch_path: Optional[str] = patch.original_file_path self.description = patch.description self.meta = patch.meta + self.docs = patch.docs self.arguments = patch.arguments if dbt.flags.STRICT_MODE: assert isinstance(self, JsonSchemaMixin) diff --git a/test/integration/029_docs_generate_tests/test_docs_generate.py b/test/integration/029_docs_generate_tests/test_docs_generate.py index 8cf96e0575a..9eeea700e60 100644 --- a/test/integration/029_docs_generate_tests/test_docs_generate.py +++ b/test/integration/029_docs_generate_tests/test_docs_generate.py @@ -843,7 +843,7 @@ def _verify_generic_macro_structure(self, manifest): 'path', 'original_file_path', 'package_name', 'root_path', 'name', 'unique_id', 'tags', 'resource_type', 'depends_on', 'meta', 'description', 'patch_path', 'arguments', - 'macro_sql', + 'macro_sql', 'docs' } ) # Don't compare the sql, just make sure it exists @@ -869,6 +869,7 @@ def _verify_generic_macro_structure(self, manifest): 'resource_type': 'macro', 'depends_on': {'macros': []}, 'description': '', + 'docs': {'show': True}, 'patch_path': None, 'meta': {}, 'arguments': [], @@ -1689,6 +1690,7 @@ def expected_postgres_references_manifest(self, model_database=None): 'name': 'test_nothing', 'depends_on': {'macros': []}, 'description': 'My custom test that I wrote that does nothing', + 'docs': {'show': True}, 'macro_sql': AnyStringWith('macro test_nothing'), 'original_file_path': self.dir('macros/dummy_test.sql'), 'path': self.dir('macros/dummy_test.sql'), diff --git a/test/unit/test_contracts_graph_parsed.py b/test/unit/test_contracts_graph_parsed.py index dace3716bbb..6324a3e4639 100644 --- a/test/unit/test_contracts_graph_parsed.py +++ b/test/unit/test_contracts_graph_parsed.py @@ -1204,6 +1204,7 @@ def _ok_dict(self): 'depends_on': {'macros': []}, 'meta': {}, 'description': 'my macro description', + 'docs': {'show': True}, 'arguments': [], }