Skip to content

Commit e74f33f

Browse files
authored
Change x-databricks-parent-service with the x-databricks-parent-name in the Python Docs Generator (#1230)
## 🥞 Stacked PR Use this [link](https://github.com/databricks/databricks-sdk-py/pull/1230/files) to review incremental changes. - [**stack/py-update-fix**](#1230) [[Files changed](https://github.com/databricks/databricks-sdk-py/pull/1230/files)] --------- ## What changes are proposed in this pull request? This PR updates the usage of x-databricks-parent-service (the service name of the parent) to x-databricks-parent-name (the tag name of the parent) in the Python Docs Generator because the latest Spec has changed upstream, and we now only populate x-databricks-parent-name. ## How is this tested? Locally generated the SDK with the new Spec. NO_CHANGELOG=true
1 parent 2c691a4 commit e74f33f

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

docs/gen-client-docs.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,13 +298,19 @@ def _load_mapping(self) -> dict[str, Tag]:
298298
mapping = {}
299299
pkgs = {p.name: p for p in self.packages}
300300
spec = json.loads(self._openapi_spec())
301+
302+
tag_by_name = {t['name']: t for t in spec['tags']}
303+
301304
for tag in spec['tags']:
302305
is_account=tag.get('x-databricks-is-accounts')
303-
# Unique identifier for the tag. Note that the service name may not be unique
306+
# Unique identifier for the tag. Note that the service name may not be unique.
304307
key = 'a' if is_account else 'w'
305-
parent_service = tag.get('x-databricks-parent-service')
306-
if parent_service:
307-
# SDK generation removes the "account" prefix from account services
308+
309+
parent_name = tag.get('x-databricks-parent-name')
310+
if parent_name:
311+
parent_tag = tag_by_name[parent_name]
312+
parent_service = parent_tag['x-databricks-service']
313+
# SDK generation removes the "account" prefix from account services.
308314
clean_parent_service = parent_service.lower().removeprefix("account")
309315
key = f"{key}.{clean_parent_service}"
310316

0 commit comments

Comments
 (0)