Reorganize REST code (#34323)
This commit is contained in:
@@ -121,7 +121,7 @@ Poke around several pages, ensure that the stylesheets are working properly, ima
|
|||||||
|
|
||||||
- [ ] In your `docs-internal` checkout, create a new branch `remove-<version>-static-files` branch: `git checkout -b remove-<version>-static-files` (you can branch off of `main` or from your `deprecate-<version>` branch, up to you).
|
- [ ] In your `docs-internal` checkout, create a new branch `remove-<version>-static-files` branch: `git checkout -b remove-<version>-static-files` (you can branch off of `main` or from your `deprecate-<version>` branch, up to you).
|
||||||
- [ ] Run `script/enterprise-server-deprecations/remove-static-files.js` and commit results.
|
- [ ] Run `script/enterprise-server-deprecations/remove-static-files.js` and commit results.
|
||||||
- [ ] Re-generate the static files by running `script/rest/update-files.js --decorate-only`.
|
- [ ] Re-generate the static files by running `src/rest/scripts/update-files.js --decorate-only`.
|
||||||
- [ ] Open a new PR.
|
- [ ] Open a new PR.
|
||||||
- [ ] Get a review from docs-engineering and merge. This step can be merged independently from step 6. The purpose of splitting up steps 5 and 6 is to focus the review on specific files.
|
- [ ] Get a review from docs-engineering and merge. This step can be merged independently from step 6. The purpose of splitting up steps 5 and 6 is to focus the review on specific files.
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ If you aren't comfortable going through the steps alone, sync up with a docs eng
|
|||||||
```
|
```
|
||||||
script/update-enterprise-dates.js
|
script/update-enterprise-dates.js
|
||||||
```
|
```
|
||||||
- [ ] Create REST files based on previous version. Copy the latest GHES version of the decorate file from `lib/rest/static/decorated` to a new file in the same directory for the new GHES release. Ex, `cp lib/rest/static/decorated/ghes-3.4.json lib/rest/static/decorated/ghes-3.5.json`.
|
- [ ] Create REST files based on previous version. Copy the latest GHES version of the decorate file from `src/rest/data` to a new file in the same directory for the new GHES release. Ex, `cp src/rest/data/ghes-3.4.json src/rest/data/ghes-3.5.json`.
|
||||||
|
|
||||||
- [ ] Create GraphQL files based on previous version:
|
- [ ] Create GraphQL files based on previous version:
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ This file should be automatically updated, but you can also run `script/update-e
|
|||||||
- [ ] [Freeze the repos](https://github.com/github/docs-content/blob/main/docs-content-docs/docs-content-workflows/freezing.md) at least 1-2 days before the release, and post an announcement in Slack so everybody knows. It's helpful to freeze the repos before doing the OpenAPI merges to avoid changes to the megabranch while preparing and deploying.
|
- [ ] [Freeze the repos](https://github.com/github/docs-content/blob/main/docs-content-docs/docs-content-workflows/freezing.md) at least 1-2 days before the release, and post an announcement in Slack so everybody knows. It's helpful to freeze the repos before doing the OpenAPI merges to avoid changes to the megabranch while preparing and deploying.
|
||||||
- [ ] Alert the Neon Squad (formally docs-ecosystem team) 1-2 days before the release to deploy to `github/github`. A PR should already be open in `github/github`, to change the OpenAPI schema config `published` to `true` in `app/api/description/config/releases/ghes-<NEXT RELEASE NUMBER>.yaml`. They will need to:
|
- [ ] Alert the Neon Squad (formally docs-ecosystem team) 1-2 days before the release to deploy to `github/github`. A PR should already be open in `github/github`, to change the OpenAPI schema config `published` to `true` in `app/api/description/config/releases/ghes-<NEXT RELEASE NUMBER>.yaml`. They will need to:
|
||||||
- [ ] Get the required approval from `@github/ecosystem-api-reviewers` then deploy the PR to dotcom. This process generally takes 30-90 minutes.
|
- [ ] Get the required approval from `@github/ecosystem-api-reviewers` then deploy the PR to dotcom. This process generally takes 30-90 minutes.
|
||||||
- [ ] Once the PR merges, make sure that the auto-generated PR titled "Update OpenAPI Descriptions" in doc-internal contains the decorated JSON files for the new GHES release. If everything looks good, merge the "Update OpenAPI Description" PR into the GHES release megabranch. **Note:** Don't attempt to resolve conflicts for changes to the `lib/rest/static/decorated` files. Instead delete the existing OpenAPI files for the release version from the megabranch (that is, revert the changes to the `lib/rest/static` decorated JSON files, e.g., from the megabranch do a `git checkout origin/main lib/rest/static/*`), so there are no conflicts to resolve and to ensure that the incoming artifacts are the correct ones.
|
- [ ] Once the PR merges, make sure that the auto-generated PR titled "Update OpenAPI Descriptions" in doc-internal contains the decorated JSON files for the new GHES release. If everything looks good, merge the "Update OpenAPI Description" PR into the GHES release megabranch. **Note:** Don't attempt to resolve conflicts for changes to the `src/rest/data` files. Instead delete the existing OpenAPI files for the release version from the megabranch (that is, revert the changes to the `src/rest/data` decorated JSON files, e.g., from the megabranch do a `git checkout origin/main src/rest/data/*`), so there are no conflicts to resolve and to ensure that the incoming artifacts are the correct ones.
|
||||||
- [ ] Alert the Ecosystem-API team in #ecosystem-api about the pending release freeze and incoming blocking review of OpenAPI updates in the public REST API description (the `rest-api-descriptions` repo). They'll need to block any future "Update OpenAPI Descriptions" PRs in the public REST API description until after the ship.
|
- [ ] Alert the Ecosystem-API team in #ecosystem-api about the pending release freeze and incoming blocking review of OpenAPI updates in the public REST API description (the `rest-api-descriptions` repo). They'll need to block any future "Update OpenAPI Descriptions" PRs in the public REST API description until after the ship.
|
||||||
- [ ] Add a blocking review to the auto-generated "Update OpenAPI Descriptions" PR in the public REST API description. (You or they will remove this blocking review once the GHES release ships.)
|
- [ ] Add a blocking review to the auto-generated "Update OpenAPI Descriptions" PR in the public REST API description. (You or they will remove this blocking review once the GHES release ships.)
|
||||||
|
|
||||||
|
|||||||
8
.github/workflows/openapi-decorate.yml
vendored
8
.github/workflows/openapi-decorate.yml
vendored
@@ -52,8 +52,8 @@ jobs:
|
|||||||
- name: Copy dereferenced OpenAPI files
|
- name: Copy dereferenced OpenAPI files
|
||||||
id: rest-api-description
|
id: rest-api-description
|
||||||
run: |
|
run: |
|
||||||
mkdir ./lib/rest/static/dereferenced
|
mkdir ./src/rest/data/dereferenced
|
||||||
find rest-api-description/descriptions-next -type f -name "*.deref.json" -exec sh -c 'cp $1 ./lib/rest/static/dereferenced' sh {} \;
|
find rest-api-description/descriptions-next -type f -name "*.deref.json" -exec sh -c 'cp $1 ./src/rest/data/dereferenced' sh {} \;
|
||||||
cd rest-api-description
|
cd rest-api-description
|
||||||
OPENAPI_COMMIT_SHA=$(git rev-parse HEAD)
|
OPENAPI_COMMIT_SHA=$(git rev-parse HEAD)
|
||||||
echo "OPENAPI_COMMIT_SHA=$OPENAPI_COMMIT_SHA" >> $GITHUB_OUTPUT
|
echo "OPENAPI_COMMIT_SHA=$OPENAPI_COMMIT_SHA" >> $GITHUB_OUTPUT
|
||||||
@@ -61,7 +61,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Decorate the dereferenced OpenAPI schemas
|
- name: Decorate the dereferenced OpenAPI schemas
|
||||||
run: |
|
run: |
|
||||||
script/rest/update-files.js --decorate-only --open-source
|
src/rest/scripts/update-files.js --decorate-only --open-source
|
||||||
git status
|
git status
|
||||||
echo "Deleting the cloned github/rest-api-description repo..."
|
echo "Deleting the cloned github/rest-api-description repo..."
|
||||||
rm -rf rest-api-description
|
rm -rf rest-api-description
|
||||||
@@ -74,7 +74,7 @@ jobs:
|
|||||||
# If nothing to commit, exit now. It's fine. No orphans.
|
# If nothing to commit, exit now. It's fine. No orphans.
|
||||||
changes=$(git diff --name-only | wc -l)
|
changes=$(git diff --name-only | wc -l)
|
||||||
if [[ $changes -eq 0 ]]; then
|
if [[ $changes -eq 0 ]]; then
|
||||||
echo "There are no changes to commit after running lib/rest/update-files.js. Exiting..."
|
echo "There are no changes to commit after running src/rest/scripts/update-files.js. Exiting..."
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -16,8 +16,6 @@ on:
|
|||||||
- 'Dockerfile*'
|
- 'Dockerfile*'
|
||||||
- 'src/**'
|
- 'src/**'
|
||||||
- 'lib/redirects/**'
|
- 'lib/redirects/**'
|
||||||
- 'lib/rest/**'
|
|
||||||
- 'lib/webhooks/**'
|
|
||||||
- 'package*.json'
|
- 'package*.json'
|
||||||
- 'script/**'
|
- 'script/**'
|
||||||
- 'content/actions/deployment/security-hardening-your-deployments/**'
|
- 'content/actions/deployment/security-hardening-your-deployments/**'
|
||||||
@@ -49,7 +47,7 @@ jobs:
|
|||||||
# Returns list of changed files matching each filter
|
# Returns list of changed files matching each filter
|
||||||
filters: |
|
filters: |
|
||||||
openapi:
|
openapi:
|
||||||
- 'lib/rest/static/**'
|
- 'src/rest/data/**'
|
||||||
notAllowed:
|
notAllowed:
|
||||||
- '.devcontainer/**'
|
- '.devcontainer/**'
|
||||||
- '.github/actions-scripts/**'
|
- '.github/actions-scripts/**'
|
||||||
@@ -60,8 +58,6 @@ jobs:
|
|||||||
- 'Dockerfile*'
|
- 'Dockerfile*'
|
||||||
- 'src/**'
|
- 'src/**'
|
||||||
- 'lib/redirects/**'
|
- 'lib/redirects/**'
|
||||||
- 'lib/rest/**'
|
|
||||||
- 'lib/webhooks/**'
|
|
||||||
- 'package*.json'
|
- 'package*.json'
|
||||||
- 'scripts/**'
|
- 'scripts/**'
|
||||||
- 'content/actions/deployment/security-hardening-your-deployments/**'
|
- 'content/actions/deployment/security-hardening-your-deployments/**'
|
||||||
@@ -83,8 +79,6 @@ jobs:
|
|||||||
'Dockerfile*',
|
'Dockerfile*',
|
||||||
'src/**',
|
'src/**',
|
||||||
'lib/redirects/**',
|
'lib/redirects/**',
|
||||||
'lib/rest/**',
|
|
||||||
'lib/webhooks/**',
|
|
||||||
'package*.json',
|
'package*.json',
|
||||||
'scripts/**',
|
'scripts/**',
|
||||||
'content/actions/deployment/security-hardening-your-deployments/**',
|
'content/actions/deployment/security-hardening-your-deployments/**',
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ USER node
|
|||||||
|
|
||||||
COPY --chown=node:node package.json /openapi-check
|
COPY --chown=node:node package.json /openapi-check
|
||||||
COPY --chown=node:node package-lock.json /openapi-check
|
COPY --chown=node:node package-lock.json /openapi-check
|
||||||
ADD --chown=node:node script /openapi-check/script
|
ADD --chown=node:node src /openapi-check/src
|
||||||
ADD --chown=node:node lib /openapi-check/lib
|
ADD --chown=node:node lib /openapi-check/lib
|
||||||
ADD --chown=node:node content /openapi-check/content
|
ADD --chown=node:node content /openapi-check/content
|
||||||
ADD --chown=node:node data /openapi-check/data
|
ADD --chown=node:node data /openapi-check/data
|
||||||
|
|
||||||
RUN npm ci -D
|
RUN npm ci -D
|
||||||
|
|
||||||
ENTRYPOINT ["node", "/openapi-check/script/rest/openapi-check.js"]
|
ENTRYPOINT ["node", "/openapi-check/src/rest/scripts/openapi-check.js"]
|
||||||
|
|||||||
@@ -5,6 +5,6 @@ The `/content/rest` directory is where the GitHub REST API docs live!
|
|||||||
* The `/content/rest/guides` and `/content/rest/overview` directories contain regular articles. These are human-editable.
|
* The `/content/rest/guides` and `/content/rest/overview` directories contain regular articles. These are human-editable.
|
||||||
* The `/content/rest/reference` directory contains an article for each group of endpoints in the GitHub REST API. Most of the content in this directory is rendered using `include` tags.
|
* The `/content/rest/reference` directory contains an article for each group of endpoints in the GitHub REST API. Most of the content in this directory is rendered using `include` tags.
|
||||||
|
|
||||||
The content rendered by `include` tags is sourced from the `/lib/rest/static` directory, which is automatically generated from the API source code internally in GitHub, and should not be edited by a human. For more information, see the [`/lib/rest/README.md`](/lib/rest/README.md).
|
The content rendered by `include` tags is sourced from the `/src/rest/data` directory, which is automatically generated from the API source code internally in GitHub, and should not be edited by a human. For more information, see the [`/src/rest/README.md`](/src/rest/README.md).
|
||||||
|
|
||||||
**We cannot accept changes to content that is rendered by `include` tags. However, you can open an issue describing the changes you would like to see.**
|
**We cannot accept changes to content that is rendered by `include` tags. However, you can open an issue describing the changes you would like to see.**
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ plans.forEach((planObj) => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
const apiFilesPath = path.join(process.cwd(), 'lib/rest/static/decorated')
|
const apiFilesPath = path.join(process.cwd(), 'src/rest/data')
|
||||||
// This is what determines which versions are calendar date versioned for the REST API docs
|
// This is what determines which versions are calendar date versioned for the REST API docs
|
||||||
// This is the source of truth for which versions are calendar date versioned.
|
// This is the source of truth for which versions are calendar date versioned.
|
||||||
fs.readdirSync(apiFilesPath)
|
fs.readdirSync(apiFilesPath)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import express from 'express'
|
import express from 'express'
|
||||||
import { getWebhook } from '../../lib/webhooks/index.js'
|
import { getWebhook } from '../../src/webhooks/lib/index.js'
|
||||||
import { allVersions } from '../../lib/all-versions.js'
|
import { allVersions } from '../../lib/all-versions.js'
|
||||||
import { defaultCacheControl } from '../cache-control.js'
|
import { defaultCacheControl } from '../cache-control.js'
|
||||||
|
|
||||||
|
|||||||
@@ -194,7 +194,7 @@
|
|||||||
"prettier": "prettier -w \"**/*.{ts,tsx,js,mjs,scss,yml,yaml}\"",
|
"prettier": "prettier -w \"**/*.{ts,tsx,js,mjs,scss,yml,yaml}\"",
|
||||||
"prettier-check": "prettier -c \"**/*.{ts,tsx,js,mjs,scss,yml,yaml}\"",
|
"prettier-check": "prettier -c \"**/*.{ts,tsx,js,mjs,scss,yml,yaml}\"",
|
||||||
"prevent-pushes-to-main": "node script/prevent-pushes-to-main.js",
|
"prevent-pushes-to-main": "node script/prevent-pushes-to-main.js",
|
||||||
"rest-dev": "script/rest/update-files.js",
|
"rest-dev": "src/rest/scripts/update-files.js",
|
||||||
"show-action-deps": "echo 'Action Dependencies:' && rg '^[\\s|-]*(uses:.*)$' .github -I -N --no-heading -r '$1$2' | sort | uniq | cut -c 7-",
|
"show-action-deps": "echo 'Action Dependencies:' && rg '^[\\s|-]*(uses:.*)$' .github -I -N --no-heading -r '$1$2' | sort | uniq | cut -c 7-",
|
||||||
"start": "cross-env NODE_ENV=development ENABLED_LANGUAGES=en nodemon server.js",
|
"start": "cross-env NODE_ENV=development ENABLED_LANGUAGES=en nodemon server.js",
|
||||||
"start-all-languages": "cross-env NODE_ENV=development nodemon server.js",
|
"start-all-languages": "cross-env NODE_ENV=development nodemon server.js",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { GetServerSideProps } from 'next'
|
|||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
import { useEffect } from 'react'
|
import { useEffect } from 'react'
|
||||||
|
|
||||||
import { getInitialPageWebhooks } from 'lib/webhooks'
|
import { getInitialPageWebhooks } from 'src/webhooks/lib'
|
||||||
import { getMainContext, MainContext, MainContextT } from 'components/context/MainContext'
|
import { getMainContext, MainContext, MainContextT } from 'components/context/MainContext'
|
||||||
import {
|
import {
|
||||||
getAutomatedPageContextFromRequest,
|
getAutomatedPageContextFromRequest,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { GetServerSideProps } from 'next'
|
import { GetServerSideProps } from 'next'
|
||||||
import getRest, { getRestMiniTocItems } from 'lib/rest/index.js'
|
import getRest, { getRestMiniTocItems } from 'src/rest/lib/index.js'
|
||||||
import { Operation } from 'components/rest/types'
|
import { Operation } from 'components/rest/types'
|
||||||
import { RestReferencePage } from 'components/rest/RestReferencePage'
|
import { RestReferencePage } from 'components/rest/RestReferencePage'
|
||||||
import { getMainContext, MainContext, MainContextT } from 'components/context/MainContext'
|
import { getMainContext, MainContext, MainContextT } from 'components/context/MainContext'
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { GetServerSideProps } from 'next'
|
import { GetServerSideProps } from 'next'
|
||||||
import getRest, { getRestMiniTocItems } from 'lib/rest/index.js'
|
import getRest, { getRestMiniTocItems } from 'src/rest/lib/index.js'
|
||||||
import nonEnterpriseDefaultVersion from 'lib/non-enterprise-default-version.js'
|
import nonEnterpriseDefaultVersion from 'lib/non-enterprise-default-version.js'
|
||||||
import { Operation } from 'components/rest/types'
|
import { Operation } from 'components/rest/types'
|
||||||
import { RestReferencePage } from 'components/rest/RestReferencePage'
|
import { RestReferencePage } from 'components/rest/RestReferencePage'
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import {
|
|||||||
import { MainContextT, MainContext, getMainContext } from 'components/context/MainContext'
|
import { MainContextT, MainContext, getMainContext } from 'components/context/MainContext'
|
||||||
import { Link } from 'components/Link'
|
import { Link } from 'components/Link'
|
||||||
import { RestRedirect } from 'components/RestRedirect'
|
import { RestRedirect } from 'components/RestRedirect'
|
||||||
import { getEnabledForApps, categoriesWithoutSubcategories } from 'lib/rest/index.js'
|
import { getEnabledForApps, categoriesWithoutSubcategories } from 'src/rest/lib/index.js'
|
||||||
|
|
||||||
type OperationT = {
|
type OperationT = {
|
||||||
slug: string
|
slug: string
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ import { allVersions } from '../../lib/all-versions.js'
|
|||||||
import { deprecated } from '../../lib/enterprise-server-releases.js'
|
import { deprecated } from '../../lib/enterprise-server-releases.js'
|
||||||
|
|
||||||
const graphqlDataDir = path.join(process.cwd(), 'data/graphql')
|
const graphqlDataDir = path.join(process.cwd(), 'data/graphql')
|
||||||
const webhooksStaticDir = path.join(process.cwd(), 'lib/webhooks/static')
|
const webhooksStaticDir = path.join(process.cwd(), 'src/webhooks/data')
|
||||||
const graphqlStaticDir = path.join(process.cwd(), 'src/graphql/data')
|
const graphqlStaticDir = path.join(process.cwd(), 'src/graphql/data')
|
||||||
const restDecoratedDir = path.join(process.cwd(), 'lib/rest/static/decorated')
|
const restDecoratedDir = path.join(process.cwd(), 'src/rest/data')
|
||||||
const ghesReleaseNotesDir = 'data/release-notes/enterprise-server'
|
const ghesReleaseNotesDir = 'data/release-notes/enterprise-server'
|
||||||
|
|
||||||
const supportedEnterpriseVersions = Object.values(allVersions).filter(
|
const supportedEnterpriseVersions = Object.values(allVersions).filter(
|
||||||
|
|||||||
@@ -12,11 +12,11 @@ import path from 'path'
|
|||||||
import { program } from 'commander'
|
import { program } from 'commander'
|
||||||
import { allVersions } from '../../lib/all-versions.js'
|
import { allVersions } from '../../lib/all-versions.js'
|
||||||
|
|
||||||
const payloadsDir = 'lib/webhooks/static'
|
const payloadsDir = 'src/webhooks/data'
|
||||||
|
|
||||||
program
|
program
|
||||||
.description(
|
.description(
|
||||||
'Create new payload files in lib/webhooks/static/<new_version> based on an existing version.'
|
'Create new payload files in src/webhooks/data/<new_version> based on an existing version.'
|
||||||
)
|
)
|
||||||
.option(
|
.option(
|
||||||
'-n, --newVersion <version>',
|
'-n, --newVersion <version>',
|
||||||
|
|||||||
@@ -2,19 +2,19 @@
|
|||||||
|
|
||||||
## About this directory
|
## About this directory
|
||||||
|
|
||||||
* `lib/rest/index.js` is human-editable.
|
* `src/rest/lib/index.js` is human-editable.
|
||||||
* `lib/rest/static/*.json` are generated by [scripts](../../script/rest/README.md).
|
* `src/rest/data/*.json` are generated by [scripts](../../src/rest/scripts/README.md).
|
||||||
|
|
||||||
## Editable files
|
## Editable files
|
||||||
|
|
||||||
* `lib/rest/index.js` consumes the static decorated schema files and exports `categories`, `operations`, and `operationsEnabledForGitHubApps` used by the REST middleware contextualizer.
|
* `src/rest/lib/index.js` consumes the static decorated schema files and exports `categories`, `operations`, and `operationsEnabledForGitHubApps` used by the REST middleware contextualizer.
|
||||||
|
|
||||||
## Static files
|
## Static files
|
||||||
|
|
||||||
Generated by `script/rest/update-files.js`:
|
Generated by `src/rest/scripts/update-files.js`:
|
||||||
|
|
||||||
* `lib/rest/static/decorated` - files generated from the dereferenced OpenAPI schema with the Markdown descriptions rendered in HTML
|
* `src/rest/data` - files generated from the dereferenced OpenAPI schema with the Markdown descriptions rendered in HTML
|
||||||
* `lib/rest/static/dereferenced` - **NOTE** These are only generated if you pass the --keep-dereferenced-files option and are not checked into the repository. This option is for debug only.
|
* `src/rest/data/dereferenced` - **NOTE** These are only generated if you pass the --keep-dereferenced-files option and are not checked into the repository. This option is for debug only.
|
||||||
|
|
||||||
## Rendering docs
|
## Rendering docs
|
||||||
|
|
||||||
@@ -1,16 +1,14 @@
|
|||||||
import { fileURLToPath } from 'url'
|
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
|
||||||
import { readCompressedJsonFileFallback } from '../read-json-file.js'
|
import { readCompressedJsonFileFallback } from '../../../lib/read-json-file.js'
|
||||||
import { getAutomatedPageMiniTocItems } from '../get-mini-toc-items.js'
|
import { getAutomatedPageMiniTocItems } from '../../../lib/get-mini-toc-items.js'
|
||||||
import { allVersions } from '../all-versions.js'
|
import { allVersions } from '../../../lib/all-versions.js'
|
||||||
import languages from '../languages.js'
|
import languages from '../../../lib/languages.js'
|
||||||
|
|
||||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
const schemasPath = 'src/rest/data'
|
||||||
const schemasPath = path.join(__dirname, 'static/decorated')
|
const ENABLED_APPS_FILENAME = 'src/github-apps/data/enabled-for-apps.json'
|
||||||
const ENABLED_APPS_FILENAME = path.join(__dirname, 'static/apps/enabled-for-apps.json')
|
const contentPath = 'content/rest'
|
||||||
const contentPath = path.join(process.cwd(), 'content/rest')
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Loads the schemas from the static/decorated folder into a single
|
Loads the schemas from the static/decorated folder into a single
|
||||||
@@ -2,15 +2,15 @@
|
|||||||
|
|
||||||
Writers run the [update-files.js](./update-files.js) script to get the latest dereferenced OpenAPI schema files.
|
Writers run the [update-files.js](./update-files.js) script to get the latest dereferenced OpenAPI schema files.
|
||||||
```
|
```
|
||||||
script/rest/update-files.js
|
src/rest/scripts/update-files.js
|
||||||
```
|
```
|
||||||
These scripts update the [static dereferenced OpenAPI files](../../lib/rest/static/dereferenced) to create [the decorated files](../../lib/rest/static/decorated) used to
|
These scripts update the dereferenced OpenAPI files to create [the decorated files](../../src/rest/data) used to
|
||||||
render REST docs. See the [`lib/rest/README`](../../lib/rest/README.md)
|
render REST docs. See the [`src/rest/README`](../../src/rest/README.md)
|
||||||
for more info.
|
for more info.
|
||||||
|
|
||||||
## Production `--decorate-only` option
|
## Production `--decorate-only` option
|
||||||
|
|
||||||
When changes to the OpenAPI are merged to the default branch of the `github/github` repository, a pull request is automatically opened with the updated dereferenced OpenAPI files. When pull requests are authored by `github-openapi-bot`, a CI test runs the `lib/rest/update-files.js` script with the `--decorate-only` option. The `--decorate-only` option only decorates the dereferenced OpenAPI files, using the existing dereferenced OpenAPI schema files, and checks those changes in to the existing branch. The `--decorate-only` option is only used by a 🤖 and is only used on production dereferenced OpenAPI schema files.
|
When changes to the OpenAPI are merged to the default branch of the `github/github` repository, a pull request is automatically opened with the updated dereferenced OpenAPI files. When pull requests are authored by `github-openapi-bot`, a CI test runs the `src/rest/scripts/update-files.js` script with the `--decorate-only` option. The `--decorate-only` option only decorates the dereferenced OpenAPI files, using the existing dereferenced OpenAPI schema files, and checks those changes in to the existing branch. The `--decorate-only` option is only used by a 🤖 and is only used on production dereferenced OpenAPI schema files.
|
||||||
|
|
||||||
The `.github/workflows/openapi-schema-check.yml` CI test checks that the dereferenced and decorated schema files match. If the files don't match, potential causes could be:
|
The `.github/workflows/openapi-schema-check.yml` CI test checks that the dereferenced and decorated schema files match. If the files don't match, potential causes could be:
|
||||||
- something went wrong when the schema changes (created by `github-openapi-bot`) were merged into another branch
|
- something went wrong when the schema changes (created by `github-openapi-bot`) were merged into another branch
|
||||||
@@ -18,4 +18,4 @@ The `.github/workflows/openapi-schema-check.yml` CI test checks that the derefer
|
|||||||
|
|
||||||
⚠️ Only do this if you know exactly what the `--decorate-only` option does. ⚠️
|
⚠️ Only do this if you know exactly what the `--decorate-only` option does. ⚠️
|
||||||
|
|
||||||
If you know that the dereferenced schema files are correct, you can run the `lib/rest/update-files.js --decorate-only` command on the branch locally to update the decorated files in your branch.
|
If you know that the dereferenced schema files are correct, you can run the `src/rest/scripts/update-files.js --decorate-only` command on the branch locally to update the decorated files in your branch.
|
||||||
@@ -9,9 +9,9 @@ import fs from 'fs'
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
|
|
||||||
import frontmatter from '../../lib/read-frontmatter.js'
|
import frontmatter from '../../../lib/read-frontmatter.js'
|
||||||
import getApplicableVersions from '../../lib/get-applicable-versions.js'
|
import getApplicableVersions from '../../../lib/get-applicable-versions.js'
|
||||||
import { allVersions, getDocsVersion } from '../../lib/all-versions.js'
|
import { allVersions, getDocsVersion } from '../../../lib/all-versions.js'
|
||||||
|
|
||||||
const contentFiles = []
|
const contentFiles = []
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ export async function getDiffOpenAPIContentRest() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function createOpenAPISchemasCheck() {
|
async function createOpenAPISchemasCheck() {
|
||||||
const schemasPath = path.join(process.cwd(), 'lib/rest/static/decorated')
|
const schemasPath = path.join(process.cwd(), 'src/rest/data')
|
||||||
const openAPICheck = createCheckObj()
|
const openAPICheck = createCheckObj()
|
||||||
const schemas = fs.readdirSync(schemasPath)
|
const schemas = fs.readdirSync(schemasPath)
|
||||||
|
|
||||||
@@ -15,10 +15,10 @@ import rimraf from 'rimraf'
|
|||||||
|
|
||||||
import { decorate } from './utils/decorator.js'
|
import { decorate } from './utils/decorator.js'
|
||||||
import { validateVersionsOptions } from './utils/get-openapi-schemas.js'
|
import { validateVersionsOptions } from './utils/get-openapi-schemas.js'
|
||||||
import { allVersions } from '../../lib/all-versions.js'
|
import { allVersions } from '../../../lib/all-versions.js'
|
||||||
|
|
||||||
const TEMP_DOCS_DIR = path.join(process.cwd(), 'openapiTmp')
|
const TEMP_DOCS_DIR = path.join(process.cwd(), 'openapiTmp')
|
||||||
const DOCS_DEREF_OPENAPI_DIR = path.join(process.cwd(), 'lib/rest/static/dereferenced')
|
const DOCS_DEREF_OPENAPI_DIR = path.join(process.cwd(), 'src/rest/data/dereferenced')
|
||||||
const GITHUB_REP_DIR = path.join(process.cwd(), '../github')
|
const GITHUB_REP_DIR = path.join(process.cwd(), '../github')
|
||||||
|
|
||||||
program
|
program
|
||||||
@@ -78,7 +78,7 @@ async function main() {
|
|||||||
// Decorate the dereferenced files in a format ingestible by docs.github.com
|
// Decorate the dereferenced files in a format ingestible by docs.github.com
|
||||||
await decorate(schemas)
|
await decorate(schemas)
|
||||||
console.log(
|
console.log(
|
||||||
'\n🏁 The static REST API files are now up-to-date with your local `github/github` checkout. To revert uncommitted changes, run `git checkout lib/rest/static/*`.\n\n'
|
'\n🏁 The static REST API files are now up-to-date with your local `github/github` checkout. To revert uncommitted changes, run `git checkout src/rest/data/*`.\n\n'
|
||||||
)
|
)
|
||||||
if (!keepDereferencedFiles) {
|
if (!keepDereferencedFiles) {
|
||||||
rimraf.sync(DOCS_DEREF_OPENAPI_DIR)
|
rimraf.sync(DOCS_DEREF_OPENAPI_DIR)
|
||||||
@@ -3,18 +3,18 @@ import { readFile, writeFile } from 'fs/promises'
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { slug } from 'github-slugger'
|
import { slug } from 'github-slugger'
|
||||||
|
|
||||||
import { allVersions } from '../../../lib/all-versions.js'
|
import { allVersions } from '../../../../lib/all-versions.js'
|
||||||
import { categoriesWithoutSubcategories } from '../../../lib/rest/index.js'
|
import { categoriesWithoutSubcategories } from '../../lib/index.js'
|
||||||
import getOperations, { getWebhooks } from './get-operations.js'
|
import getOperations, { getWebhooks } from './get-operations.js'
|
||||||
|
|
||||||
const ENABLED_APPS = 'lib/rest/static/apps/enabled-for-apps.json'
|
const ENABLED_APPS = 'src/github-apps/data/enabled-for-apps.json'
|
||||||
const STATIC_REDIRECTS = 'lib/redirects/static/client-side-rest-api-redirects.json'
|
const STATIC_REDIRECTS = 'lib/redirects/static/client-side-rest-api-redirects.json'
|
||||||
const REST_DECORATED_DIR = 'lib/rest/static/decorated'
|
const REST_DECORATED_DIR = 'src/rest/data'
|
||||||
const WEBHOOK_DECORATED_DIR = 'lib/webhooks/static/decorated'
|
const WEBHOOK_DECORATED_DIR = 'src/webhooks/data'
|
||||||
const REST_DEREFERENCED_DIR = 'lib/rest/static/dereferenced'
|
const REST_DEREFERENCED_DIR = 'src/rest/data/dereferenced'
|
||||||
|
|
||||||
export async function decorate(schemas) {
|
export async function decorate(schemas) {
|
||||||
console.log('\n🎄 Decorating the OpenAPI schema files in lib/rest/static/dereferenced.\n')
|
console.log('\n🎄 Decorating the OpenAPI schema files in src/rest/data/dereferenced.\n')
|
||||||
const { restSchemas, webhookSchemas } = await getOpenApiSchemaFiles(schemas)
|
const { restSchemas, webhookSchemas } = await getOpenApiSchemaFiles(schemas)
|
||||||
const webhookOperations = await getWebhookOperations(webhookSchemas)
|
const webhookOperations = await getWebhookOperations(webhookSchemas)
|
||||||
await createStaticWebhookFiles(webhookOperations)
|
await createStaticWebhookFiles(webhookOperations)
|
||||||
@@ -230,7 +230,7 @@ async function createStaticWebhookFiles(webhookSchemas) {
|
|||||||
|
|
||||||
async function getCategoryOverrideRedirects() {
|
async function getCategoryOverrideRedirects() {
|
||||||
const { operationUrls, sectionUrls } = JSON.parse(
|
const { operationUrls, sectionUrls } = JSON.parse(
|
||||||
await readFile('script/rest/utils/rest-api-overrides.json', 'utf8')
|
await readFile('src/rest/scripts/utils/rest-api-overrides.json', 'utf8')
|
||||||
)
|
)
|
||||||
|
|
||||||
const operationRedirects = {}
|
const operationRedirects = {}
|
||||||
@@ -253,7 +253,7 @@ async function getCategoryOverrideRedirects() {
|
|||||||
|
|
||||||
async function addRestClientSideRedirects(operations, clientSideRedirects) {
|
async function addRestClientSideRedirects(operations, clientSideRedirects) {
|
||||||
// For each rest operation that doesn't have an override defined
|
// For each rest operation that doesn't have an override defined
|
||||||
// in script/rest/utils/rest-api-overrides.json,
|
// in src/rest/scripts/utils/rest-api-overrides.json,
|
||||||
// add a client-side redirect
|
// add a client-side redirect
|
||||||
operations.forEach((operation) => {
|
operations.forEach((operation) => {
|
||||||
// A handful of operations don't have external docs properties
|
// A handful of operations don't have external docs properties
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
import renderContent from '../../../lib/render-content/index.js'
|
import renderContent from '../../../../lib/render-content/index.js'
|
||||||
|
|
||||||
// If there is a oneOf at the top level, then we have to present just one
|
// If there is a oneOf at the top level, then we have to present just one
|
||||||
// in the docs. We don't currently have a convention for showing more than one
|
// in the docs. We don't currently have a convention for showing more than one
|
||||||
@@ -2,7 +2,7 @@ import { readFile, readdir } from 'fs/promises'
|
|||||||
import yaml from 'js-yaml'
|
import yaml from 'js-yaml'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
|
||||||
import { allVersions } from '../../../lib/all-versions.js'
|
import { allVersions } from '../../../../lib/all-versions.js'
|
||||||
const OPEN_API_RELEASES_DIR = path.join('..', 'github', '/app/api/description/config/releases')
|
const OPEN_API_RELEASES_DIR = path.join('..', 'github', '/app/api/description/config/releases')
|
||||||
|
|
||||||
// Gets the full list of unpublished + active, deprecated + active,
|
// Gets the full list of unpublished + active, deprecated + active,
|
||||||
@@ -5,13 +5,13 @@ import { readFile } from 'fs/promises'
|
|||||||
import { get, isPlainObject } from 'lodash-es'
|
import { get, isPlainObject } from 'lodash-es'
|
||||||
import { parseTemplate } from 'url-template'
|
import { parseTemplate } from 'url-template'
|
||||||
|
|
||||||
import renderContent from '../../../lib/render-content/index.js'
|
import renderContent from '../../../../lib/render-content/index.js'
|
||||||
import getCodeSamples from './create-rest-examples.js'
|
import getCodeSamples from './create-rest-examples.js'
|
||||||
import operationSchema from './operation-schema.js'
|
import operationSchema from './operation-schema.js'
|
||||||
import { getBodyParams } from './get-body-params.js'
|
import { getBodyParams } from './get-body-params.js'
|
||||||
|
|
||||||
const { operationUrls } = JSON.parse(
|
const { operationUrls } = JSON.parse(
|
||||||
await readFile('script/rest/utils/rest-api-overrides.json', 'utf8')
|
await readFile('src/rest/scripts/utils/rest-api-overrides.json', 'utf8')
|
||||||
)
|
)
|
||||||
|
|
||||||
export default class Operation {
|
export default class Operation {
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
import Ajv from 'ajv'
|
import Ajv from 'ajv'
|
||||||
import { get, isPlainObject } from 'lodash-es'
|
import { get, isPlainObject } from 'lodash-es'
|
||||||
|
|
||||||
import renderContent from '../../../lib/render-content/index.js'
|
import renderContent from '../../../../lib/render-content/index.js'
|
||||||
import webhookSchema from './webhook-schema.js'
|
import webhookSchema from './webhook-schema.js'
|
||||||
import { getBodyParams } from './get-body-params.js'
|
import { getBodyParams } from './get-body-params.js'
|
||||||
|
|
||||||
@@ -2,19 +2,19 @@
|
|||||||
|
|
||||||
## About this directory
|
## About this directory
|
||||||
|
|
||||||
* `lib/webhooks/index.js` is human-editable.
|
* `src/webhooks/lib/index.js` is human-editable.
|
||||||
* `lib/rest/static/**/*.payload.json` are manually edited and copied. When a new GHES release is created, the static webhook files from the previous version's directory are copied to a new version directory.
|
* `src/rest/data/**/*.payload.json` are manually edited and copied. When a new GHES release is created, the static webhook files from the previous version's directory are copied to a new version directory.
|
||||||
|
|
||||||
## Editable files
|
## Editable files
|
||||||
|
|
||||||
* `lib/webhooks/index.js` consumes the static JSON files in `lib/webhooks/static` and exports the data used by the REST middleware contextualizer.
|
* `src/webhooks/lib/index.js` consumes the static JSON files in `src/webhooks/data` and exports the data used by the REST middleware contextualizer.
|
||||||
|
|
||||||
## Static files
|
## Static files
|
||||||
|
|
||||||
Generated by `script/rest/update-files.js`:
|
Generated by `src/rest/scripts/update-files.js`:
|
||||||
|
|
||||||
* `lib/rest/static/decorated` - files generated from the dereferenced OpenAPI schema with the Markdown descriptions rendered in HTML
|
* `src/rest/data` - files generated from the dereferenced OpenAPI schema with the Markdown descriptions rendered in HTML
|
||||||
* `lib/rest/static/dereferenced` - **NOTE** These are only generated if you pass the --keep-dereferenced-files option and are not checked into the repository. This option is for debug only.
|
* `src/rest/data/dereferenced` - **NOTE** These are only generated if you pass the --keep-dereferenced-files option and are not checked into the repository. This option is for debug only.
|
||||||
|
|
||||||
## Rendering docs
|
## Rendering docs
|
||||||
|
|
||||||
@@ -1,11 +1,9 @@
|
|||||||
import { fileURLToPath } from 'url'
|
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
|
||||||
import { allVersions } from '../all-versions.js'
|
import { allVersions } from '../../../lib/all-versions.js'
|
||||||
import { readCompressedJsonFileFallback } from '../read-json-file.js'
|
import { readCompressedJsonFileFallback } from '../../../lib/read-json-file.js'
|
||||||
|
|
||||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
const schemasPath = 'src/webhooks/data'
|
||||||
const schemasPath = path.join(__dirname, 'static/decorated')
|
|
||||||
|
|
||||||
// cache for webhook data per version
|
// cache for webhook data per version
|
||||||
const webhooksCache = new Map()
|
const webhooksCache = new Map()
|
||||||
@@ -79,8 +79,6 @@ const ALLOW_DOCS_PATHS = [
|
|||||||
'contributing/search.md',
|
'contributing/search.md',
|
||||||
'docs/index.yaml',
|
'docs/index.yaml',
|
||||||
'lib/excluded-links.js',
|
'lib/excluded-links.js',
|
||||||
'lib/rest/**/*.json',
|
|
||||||
'lib/webhooks/**/*.json',
|
|
||||||
'ownership.yaml',
|
'ownership.yaml',
|
||||||
'script/README.md',
|
'script/README.md',
|
||||||
'script/toggle-ghae-feature-flags.js',
|
'script/toggle-ghae-feature-flags.js',
|
||||||
@@ -111,7 +109,7 @@ const IGNORE_PATHS = [
|
|||||||
'.linkinator/full.log', // Only present if you've run linkinator
|
'.linkinator/full.log', // Only present if you've run linkinator
|
||||||
'lib/search/popular-pages.json', // used to build search indexes
|
'lib/search/popular-pages.json', // used to build search indexes
|
||||||
'tests/**/*.json',
|
'tests/**/*.json',
|
||||||
|
'src/**/*.json', // OpenAPI schema files
|
||||||
'content/early-access', // Not committed to public repository.
|
'content/early-access', // Not committed to public repository.
|
||||||
'data/early-access', // Not committed to public repository.
|
'data/early-access', // Not committed to public repository.
|
||||||
'data/release-notes', // These include links to many internal issues in Liquid comments.
|
'data/release-notes', // These include links to many internal issues in Liquid comments.
|
||||||
|
|||||||
@@ -4,15 +4,18 @@ import { readdirSync, readFileSync } from 'fs'
|
|||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
|
|
||||||
import { get, getDOM } from '../helpers/e2etest.js'
|
import { get, getDOM } from '../helpers/e2etest.js'
|
||||||
import getRest, { getEnabledForApps, categoriesWithoutSubcategories } from '../../lib/rest/index.js'
|
import getRest, {
|
||||||
|
getEnabledForApps,
|
||||||
|
categoriesWithoutSubcategories,
|
||||||
|
} from '../../src/rest/lib/index.js'
|
||||||
import { isApiVersioned, allVersions } from '../../lib/all-versions.js'
|
import { isApiVersioned, allVersions } from '../../lib/all-versions.js'
|
||||||
import { getDiffOpenAPIContentRest } from '../../script/rest/test-open-api-schema.js'
|
import { getDiffOpenAPIContentRest } from '../../src/rest/scripts/test-open-api-schema.js'
|
||||||
|
|
||||||
describe('REST references docs', () => {
|
describe('REST references docs', () => {
|
||||||
jest.setTimeout(3 * 60 * 1000)
|
jest.setTimeout(3 * 60 * 1000)
|
||||||
|
|
||||||
test('all category and subcategory REST pages render for free-pro-team', async () => {
|
test('all category and subcategory REST pages render for free-pro-team', async () => {
|
||||||
const DECORATED_DIR = 'lib/rest/static/decorated'
|
const DECORATED_DIR = 'src/rest/data'
|
||||||
// This currently just grabs the 'free-pro-team' schema, but ideally, we'd
|
// This currently just grabs the 'free-pro-team' schema, but ideally, we'd
|
||||||
// get a list of all categories across all versions.
|
// get a list of all categories across all versions.
|
||||||
const freeProTeamFile = readdirSync(DECORATED_DIR)
|
const freeProTeamFile = readdirSync(DECORATED_DIR)
|
||||||
@@ -161,7 +164,7 @@ function formatErrors(differences) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
errorMessage += `
|
errorMessage += `
|
||||||
This test checks that the categories and subcategories in the content/rest directory matches the decorated schemas in lib/rest/static/decorated for each version of the REST API.
|
This test checks that the categories and subcategories in the content/rest directory matches the decorated schemas in src/rest/data for each version of the REST API.
|
||||||
|
|
||||||
If you have made changes to the categories or subcategories in the content/rest directory, either in the frontmatter or the structure of the directory, you will need to ensure that it matches the operations in the OpenAPI description. For example, if an operation is available in GHAE, the frontmatter versioning in the relevant docs category and subcategory files also need to be versioned for GHAE. If you are adding category or subcategory files to the content/rest directory, the OpenAPI dereferenced files must have at least one operation that will be shown for the versions in the category or subcategory files. If this is the case, it is likely that the description files have not been updated from github/github yet.
|
If you have made changes to the categories or subcategories in the content/rest directory, either in the frontmatter or the structure of the directory, you will need to ensure that it matches the operations in the OpenAPI description. For example, if an operation is available in GHAE, the frontmatter versioning in the relevant docs category and subcategory files also need to be versioned for GHAE. If you are adding category or subcategory files to the content/rest directory, the OpenAPI dereferenced files must have at least one operation that will be shown for the versions in the category or subcategory files. If this is the case, it is likely that the description files have not been updated from github/github yet.
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { jest } from '@jest/globals'
|
import { jest } from '@jest/globals'
|
||||||
import { getDOM } from '../helpers/e2etest.js'
|
import { getDOM } from '../helpers/e2etest.js'
|
||||||
import { allVersions } from '../../lib/all-versions.js'
|
import { allVersions } from '../../lib/all-versions.js'
|
||||||
import { getWebhooks } from '../../lib/webhooks/index.js'
|
import { getWebhooks } from '../../src/webhooks/lib/index.js'
|
||||||
|
|
||||||
describe('webhooks events and payloads', () => {
|
describe('webhooks events and payloads', () => {
|
||||||
jest.setTimeout(300 * 1000)
|
jest.setTimeout(300 * 1000)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { describe, expect } from '@jest/globals'
|
import { describe, expect } from '@jest/globals'
|
||||||
|
|
||||||
import { getOpenApiSchemaFiles } from '../../script/rest/utils/decorator.js'
|
import { getOpenApiSchemaFiles } from '../../src/rest/scripts/utils/decorator.js'
|
||||||
import { allVersions } from '../../lib/all-versions.js'
|
import { allVersions } from '../../lib/all-versions.js'
|
||||||
|
|
||||||
const supportedReleases = Object.keys(allVersions).map(
|
const supportedReleases = Object.keys(allVersions).map(
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { describe, expect } from '@jest/globals'
|
import { describe, expect } from '@jest/globals'
|
||||||
import getCodeSamples, { mergeExamples } from '../../script/rest/utils/create-rest-examples.js'
|
import getCodeSamples, { mergeExamples } from '../../src/rest/scripts/utils/create-rest-examples.js'
|
||||||
import {
|
import {
|
||||||
operation,
|
operation,
|
||||||
noContent,
|
noContent,
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import fs from 'fs/promises'
|
import fs from 'fs/promises'
|
||||||
import { fileURLToPath } from 'url'
|
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
|
||||||
import { describe } from '@jest/globals'
|
import { describe } from '@jest/globals'
|
||||||
@@ -7,10 +6,9 @@ import walk from 'walk-sync'
|
|||||||
import { isPlainObject, difference } from 'lodash-es'
|
import { isPlainObject, difference } from 'lodash-es'
|
||||||
|
|
||||||
import { isApiVersioned, allVersions } from '../../lib/all-versions.js'
|
import { isApiVersioned, allVersions } from '../../lib/all-versions.js'
|
||||||
import getRest from '../../lib/rest/index.js'
|
import getRest from '../../src/rest/lib/index.js'
|
||||||
|
|
||||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
const schemasPath = 'src/rest/data'
|
||||||
const schemasPath = path.join(__dirname, '../../lib/rest/static/decorated')
|
|
||||||
|
|
||||||
async function getFlatListOfOperations(version) {
|
async function getFlatListOfOperations(version) {
|
||||||
const flatList = []
|
const flatList = []
|
||||||
@@ -69,7 +67,7 @@ describe('markdown for each rest version', () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const referenceDir = path.join(__dirname, '../../content/rest')
|
const referenceDir = path.join('content/rest')
|
||||||
const filenames = (await fs.readdir(referenceDir))
|
const filenames = (await fs.readdir(referenceDir))
|
||||||
.filter(
|
.filter(
|
||||||
(filename) =>
|
(filename) =>
|
||||||
|
|||||||
Reference in New Issue
Block a user