## Problem
Our API docs are generated from a specfile that is hosted in
https://us.app.unleash-hosted.com/ushosted
By default the API docs UI will show that URL, which we don't want
![image](https://github.com/user-attachments/assets/c125cf6c-8c97-4a56-84a8-3989725d2e95)
## Previously
We ran a find-and-replace after the mdx files were generated with
`replace-in-file`
## Now
The previous solution is no longer possible because the openapi plugin
changed. Basically, before it generated markdown files that looked like
this:
```
# Create API Key
https://unleash-hosted/whatever
bla bla bla
```
Now it generates files that do not contain the URL and look like this:
```
import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint";
import ParamsDetails from "@theme/ParamsDetails";
<Heading
as={"h1"}
className={"openapi__heading"}
children={"Configure project access"}
>
</Heading>
```
which themselves get compiled.
## Solution
This PR now downloads the specfile, makes a local copy, then an alters
the server URL in the copy, then uses that local file to generate the
docs.
![image](https://github.com/user-attachments/assets/039644a6-1e72-4145-9c67-9e6203b1673b)
I didn't want to make any changes to the actual spec logic because this
essentially just a plugin quirk
---
[PREVIEW
LINK](https://unleash-docs-git-alvin-fix-openapi-rename-unleash-team.vercel.app/reference/api/unleash/get-addon)
This PR adds more tests to check a few more cases for the lifecycle
calculation query. Specifically, it tests that:
- If we don't have any data for a stage, we return `null`.
- We filter on projects
- It correctly takes `0` days into account when calculating averages.