Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(docs): ingest - add tab for config json schema #5086

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion metadata-ingestion-modules/airflow-plugin/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def get_long_description():
"typing-inspect",
"pydantic>=1.5.1",
"apache-airflow >= 1.10.2",
"acryl-datahub[airflow]",
"acryl-datahub[airflow] >= 0.8.36",
}


Expand Down
17 changes: 17 additions & 0 deletions metadata-ingestion/scripts/docgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,11 @@ def generate(
os.makedirs(config_dir, exist_ok=True)
with open(f"{config_dir}/{plugin_name}_config.json", "w") as f:
f.write(source_config_class.schema_json(indent=2))

create_or_update(source_documentation,
[platform_id, "plugins", plugin_name, "config_schema"],
source_config_class.schema_json(indent=2) or "",
)

table_md = gen_md_table_from_struct(source_config_class.schema())
create_or_update(
Expand Down Expand Up @@ -644,6 +649,7 @@ def generate(

with open(platform_doc_file, "w") as f:
if "name" in platform_docs:
f.write(f"import Tabs from '@theme/Tabs';\nimport TabItem from '@theme/TabItem';\n\n")
f.write(f"# {platform_docs['name']}\n")
if len(platform_docs["plugins"].keys()) > 1:
# More than one plugin used to provide integration with this platform
Expand Down Expand Up @@ -716,6 +722,8 @@ def generate(
f.write("\n```\n")
if "config" in plugin_docs:
f.write("\n### Config Details\n")
f.write("""<Tabs>
<TabItem value="options" label="Options" default>\n\n""")
f.write(
"Note that a `.` is used to denote nested fields in the YAML recipe.\n\n"
)
Expand All @@ -725,6 +733,15 @@ def generate(
for doc in plugin_docs["config"]:
f.write(doc)
f.write("\n</details>\n\n")
f.write(f"""</TabItem>
<TabItem value="schema" label="Schema">
The [JSONSchema](https://json-schema.org/) for this configuration is inlined below.\n\n
```javascript
{plugin_docs['config_schema']}
```\n\n
</TabItem>
</Tabs>\n\n""")
# insert custom plugin docs after config details
f.write(plugin_docs.get("custom_docs", ""))
if "classname" in plugin_docs:
Expand Down