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

#1391: add generated doc cleaning script #2077

Merged
merged 6 commits into from
Sep 20, 2022
Merged

Conversation

thomasheartman
Copy link
Contributor

@thomasheartman thomasheartman commented Sep 20, 2022

What

The cleaning script replaces all references to the Unleash ushosted instance in the generated OpenAPI docs. It removes extra path segments (such as leading /ushosted instances) and replaces the ushosted base url with something user-agnostic.

Why

When we host the OpenAPI docs in our official documentation, the generated docs shouldn't necessarily point at one specific instance, and especially not one that the reader is unlikely to ever use. Instead, we can remove all the bits that are specific to the generation source we use, and make the docs easier to use. In particular, removing the leading /ushosted is likely to save us loooots of questions.

How

By adding a new dev dependency (replace-in-file) and running the script after doc generation.

Bonus changes

This PR also changes which environment variable controls whether you're pointing at a local API or the ushosted api.

## What

The cleaning script replaces all references to the Unleash ushosted instance in the
generated OpenAPI docs. It removes extra path segments (such as leading
`/ushosted` instances) and replaces the ushosted base url with something
user-agnostic.

## Why

When we host the OpenAPI docs in our official documentation, the generated
docs shouldn't necessarily point at _one specific instance_, and especially
not one that the reader is unlikely to ever use. Instead, we can remove all
the bits that are specific to the generation source we use, and make the docs
easier to use. In particular, removing the leading `/ushosted` is likely to
save us loooots of questions.
@vercel
Copy link

vercel bot commented Sep 20, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
unleash ✅ Ready (Inspect) Visit Preview Sep 20, 2022 at 7:39AM (UTC)
unleash-docs ✅ Ready (Inspect) Visit Preview Sep 20, 2022 at 7:39AM (UTC)
1 Ignored Deployment
Name Status Preview Updated
unleash-monorepo-frontend ⬜️ Ignored (Inspect) Sep 20, 2022 at 7:39AM (UTC)

Using NODE_ENV=development doesn't necessarily make sense, so adding
an extra variable sounds reasonable to me.
@github-actions
Copy link

github-actions bot commented Sep 20, 2022

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements
88.36% (-3.02% 🔻)
7059/7989
🟡 Branches 78.87% 1101/1396
🟢 Functions
81.89% (-4.34% 🔻)
1985/2424
🟢 Lines
88.66% (-2.64% 🔻)
6545/7382

⚠️ Details were not displayed: the report size has exceeded the limit.

Test suite run success

1160 tests passing in 191 suites.

Report generated by 🧪jest coverage report action from e1dfcde

In the event that we change the base URL of OpenAPI, so that paths
don't start with `/ushosted/`, the script should still work, changing
those paths into <your-unleash-url> too.

Additionally, remove all instances of `/ushosted` that we find. In the
event that some things switch around or whatever.
Copy link
Contributor

@chriswk chriswk left a comment

Choose a reason for hiding this comment

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

Nice :)

@thomasheartman thomasheartman merged commit 0a99dfd into main Sep 20, 2022
@thomasheartman thomasheartman deleted the #1391/sanitize-openapi branch September 20, 2022 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants