Skip to content

Commit

Permalink
[docs] fix relative links from libraries (#21847)
Browse files Browse the repository at this point in the history
## Summary & Motivation

- Return type links were broken from librariesp
- This was because the `root` variable in `pack_json.py` assumed a
relative link when it was an absolute link
- Now, the `pack_json.py` script appropriately replaces `../..` relative
links to `../`


![image](https://github.com/dagster-io/dagster/assets/5807118/f1fb0a26-fc41-4f29-a045-fde73e4b16b3)

## How I Tested These Changes

- built and previewed docs locally

---

*Broken Links Before*

```
$ npx broken-link-checker https://docs.dagster.io/_apidocs/libraries/dagster-dbt -o
(node:99101) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Getting links from: https://docs.dagster.io/_apidocs/libraries/dagster-dbt
├───OK─── https://dagster.io/
├───OK─── https://docs.dagster.io/assets/logos/dagster_logo_primary.svg
├───OK─── https://docs.dagster.io/
├───OK─── https://dagster.io/blog
├───OK─── https://dagster.io/community
├───OK─── https://courses.dagster.io/
├───OK─── https://dagster.io/slack
├───OK─── https://github.com/dagster-io/dagster
├───OK─── https://docs.dagster.io/assets/logos/github.svg
├───OK─── https://dagster.cloud/signup
├───OK─── https://dagster.cloud/
├───OK─── https://docs.dagster.io/getting-started/what-why-dagster
├───OK─── https://docs.dagster.io/getting-started/quickstart
├───OK─── https://docs.dagster.io/getting-started/install
├───OK─── https://docs.dagster.io/getting-started/create-new-project
├───OK─── https://docs.dagster.io/getting-started/getting-help
├───OK─── https://docs.dagster.io/tutorial
├───OK─── https://docs.dagster.io/concepts
├───OK─── https://docs.dagster.io/deployment
├───OK─── https://docs.dagster.io/integrations
├───OK─── https://docs.dagster.io/guides
├───OK─── https://docs.dagster.io/_apidocs
├───OK─── https://docs.dagster.io/integrations/dbt
├───OK─── https://docs.dagster.io/integrations/dbt-cloud
├───OK─── https://docs.dagster.io/_modules/dagster_dbt/asset_decorator#dbt_assets
├─BROKEN─ https://docs.dagster.io/partitions#dagster.PartitionsDefinition (HTTP_404)
├─BROKEN─ https://docs.dagster.io/partitions#dagster.BackfillPolicy (HTTP_404)
├─BROKEN─ https://docs.dagster.io/resources#dagster.ResourceDefinition (HTTP_404)
├─BROKEN─ https://docs.dagster.io/config#dagster.Config (HTTP_404)
├───OK─── https://docs.dagster.io/_modules/dagster_dbt/dagster_dbt_translator#DagsterDbtTranslator
├───OK─── https://docs.getdbt.com/reference/artifacts/manifest-json#resource-details
├─BROKEN─ https://docs.dagster.io/assets#dagster.AssetKey (HTTP_404)
├─BROKEN─ https://docs.dagster.io/assets#dagster.AutoMaterializePolicy (HTTP_404)
├─BROKEN─ https://docs.dagster.io/assets#dagster.AutoMaterializePolicy (HTTP_404)
├─BROKEN─ https://docs.dagster.io/assets#dagster.FreshnessPolicy (HTTP_404)
├─BROKEN─ https://docs.dagster.io/assets#dagster.FreshnessPolicy (HTTP_404)
├─BROKEN─ https://docs.dagster.io/partitions#dagster.PartitionMapping (HTTP_404)
├───OK─── https://docs.dagster.io/_modules/dagster_dbt/dbt_manifest_asset_selection#DbtManifestAssetSelection
├───OK─── https://docs.dagster.io/_modules/dagster_dbt/asset_utils#build_dbt_asset_selection
├───OK─── https://docs.getdbt.com/reference/node-selection/syntax#how-does-selection-work
├─BROKEN─ https://docs.dagster.io/assets#dagster.AssetSelection (HTTP_404)
├─BROKEN─ https://docs.dagster.io/config#dagster.RunConfig (HTTP_404)
├─BROKEN─ https://docs.dagster.io/schedules-sensors#dagster.ScheduleDefinition (HTTP_404)
├─BROKEN─ https://docs.dagster.io/assets#dagster.AssetsDefinition (HTTP_404)
├─BROKEN─ https://docs.dagster.io/assets#dagster.AssetKey (HTTP_404)
├─BROKEN─ https://docs.dagster.io/assets#dagster.AssetKey (HTTP_404)
├─BROKEN─ https://docs.dagster.io/assets#dagster.AssetKey (HTTP_404)
├───OK─── https://docs.dagster.io/_modules/dagster_dbt/dbt_project#DbtProject
├───OK─── https://docs.dagster.io/_modules/dagster_dbt/core/resources_v2#DbtCliResource
├───OK─── https://docs.getdbt.com/reference/dbt_project.yml
├─BROKEN─ https://docs.getdbt.com/reference/global-configs (HTTP_308)
├───OK─── https://docs.getdbt.com/docs/core/connect-data-platform/connection-profiles
├─BROKEN─ https://docs.dagster.io/execution#dagster.OpExecutionContext (HTTP_404)
├─BROKEN─ https://docs.dagster.io/execution#dagster.AssetExecutionContext (HTTP_404)
├───OK─── https://docs.getdbt.com/reference/artifacts/dbt-artifacts
├─BROKEN─ https://docs.dagster.io/ops#dagster.Output (HTTP_404)
├─BROKEN─ https://docs.dagster.io/ops#dagster.AssetMaterialization (HTTP_404)
├─BROKEN─ https://docs.dagster.io/assets#dagster.AssetObservation (HTTP_404)
├─BROKEN─ https://docs.dagster.io/asset-checks#dagster.AssetCheckResult (HTTP_404)
├───OK─── https://docs.getdbt.com/reference/events-logging#structured-logging
├─BROKEN─ https://docs.dagster.io/execution#dagster.OpExecutionContext (HTTP_404)
├─BROKEN─ https://docs.dagster.io/ops#dagster.Output (HTTP_404)
├─BROKEN─ https://docs.dagster.io/ops#dagster.AssetMaterialization (HTTP_404)
├─BROKEN─ https://docs.dagster.io/assets#dagster.AssetObservation (HTTP_404)
├─BROKEN─ https://docs.dagster.io/asset-checks#dagster.AssetCheckResult (HTTP_404)
├───OK─── https://docs.dagster.io/_modules/dagster_dbt/asset_defs#load_assets_from_dbt_project
├─BROKEN─ https://docs.dagster.io/execution#dagster.OpExecutionContext (HTTP_404)
├─BROKEN─ https://docs.dagster.io/partitions#dagster.PartitionsDefinition (HTTP_404)
├─BROKEN─ https://docs.dagster.io/assets#dagster.FreshnessPolicy (HTTP_404)
├─BROKEN─ https://docs.dagster.io/assets#dagster.AutoMaterializePolicy (HTTP_404)
├─BROKEN─ https://docs.dagster.io/execution#dagster.OpExecutionContext (HTTP_404)
├─BROKEN─ https://docs.dagster.io/partitions#dagster.PartitionsDefinition (HTTP_404)
├─BROKEN─ https://docs.dagster.io/assets#dagster.FreshnessPolicy (HTTP_404)
├─BROKEN─ https://docs.dagster.io/assets#dagster.AutoMaterializePolicy (HTTP_404)
├───OK─── https://docs.dagster.io/_modules/dagster_dbt/core/types#DbtCliOutput
├───OK─── https://docs.dagster.io/_modules/dagster_dbt/core/resources#dbt_cli_resource
├───OK─── https://docs.dagster.io/_modules/dagster_dbt/ops#dbt_run_op
├───OK─── https://docs.dagster.io/_modules/dagster_dbt/cloud/asset_defs#load_assets_from_dbt_cloud_job
├─BROKEN─ https://docs.dagster.io/resources#dagster.ResourceDefinition (HTTP_404)
├─BROKEN─ https://docs.dagster.io/assets#dagster.FreshnessPolicy (HTTP_404)
├─BROKEN─ https://docs.dagster.io/assets#dagster.AutoMaterializePolicy (HTTP_404)
├─BROKEN─ https://docs.dagster.io/partitions#dagster.PartitionsDefinition (HTTP_404)
├───OK─── https://docs.dagster.io/_modules/dagster_dbt/cloud/ops#dbt_cloud_run_op
├───OK─── https://cloud.getdbt.com/#/accounts
├───OK─── https://docs.dagster.io/_modules/dagster_dbt/cloud/resources#DbtCloudClientResource
├─BROKEN─ https://docs.getdbt.com/docs/dbt-cloud/dbt-cloud-api/service-tokens (HTTP_308)
├─BROKEN─ https://my_org.cloud.getdbt.com/ (HTTP_404)
├───OK─── https://docs.getdbt.com/dbt-cloud/api-v2
├───OK─── https://docs.dagster.io/concepts/configuration/configured
├───OK─── https://docs.dagster.io/_modules/dagster_dbt/types#DbtOutput
├───OK─── https://docs.dagster.io/_modules/dagster_dbt/dbt_resource#DbtResource
├───OK─── https://docs.dagster.io/_modules/dagster_dbt/errors#DagsterDbtError
├─BROKEN─ https://docs.getdbt.com/reference/dbt-artifacts#run_resultsjson (HTTP_308)
├───OK─── https://docs.dagster.io/_modules/dagster_dbt/utils#generate_materializations
```
  • Loading branch information
cmpadden committed May 14, 2024
1 parent d79d3b9 commit 475d9c4
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 0 deletions.
Binary file modified docs/content/api/modules.json.gz
Binary file not shown.
Binary file modified docs/content/api/searchindex.json.gz
Binary file not shown.
Binary file modified docs/content/api/sections.json.gz
Binary file not shown.
5 changes: 5 additions & 0 deletions docs/scripts/pack_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ def rewrite_relative_links(root: str, file_data: Dict[str, object]) -> None:
if not file_body:
return

# `root` can be an absolute path (eg. `/src/dagster/docs/scripts/../sphinx/_build/json/...`
# causing the `root.startswith` logic to fail. If `root` contains `/../` split to only take the
# relative sphinx path.
root = root.split("/../")[-1]

if root.startswith("sphinx/_build/json/_modules"):
transformed = re.sub(
r"href=\"[^\"]*\"",
Expand Down

1 comment on commit 475d9c4

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for dagster-docs ready!

✅ Preview
https://dagster-docs-o0ctu3v1t-elementl.vercel.app
https://master.dagster.dagster-docs.io

Built with commit 475d9c4.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.