Skip to content

Commit c19b53b

Browse files
committed
add openapi specs directly into the repository
1 parent 2c013bc commit c19b53b

File tree

356 files changed

+33446
-11463
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

356 files changed

+33446
-11463
lines changed

.github/workflows/apiary.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ jobs:
1111

1212
steps:
1313
- uses: actions/checkout@v4
14-
- name: Use Node.js 20
14+
- name: Use Node.js 22
1515
uses: actions/setup-node@v4
1616
with:
17-
node-version: 20
17+
node-version: 22
1818

1919
- name: Install apiaryio
2020
run: sudo gem install apiaryio

.github/workflows/lychee.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ jobs:
1111
steps:
1212
- uses: actions/checkout@v4
1313

14-
- name: Use Node.js 20
14+
- name: Use Node.js 22
1515
uses: actions/setup-node@v4
1616
with:
17-
node-version: 20
17+
node-version: 22
1818
cache: 'npm'
1919
cache-dependency-path: 'package-lock.json'
2020
always-auth: 'true'

.github/workflows/openapi.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Check OpenAPI specs
2+
3+
on:
4+
push:
5+
6+
#env:
7+
# APIFY_STAGING_TOKEN: ${{ secrets.APIFY_STAGING_TOKEN }}
8+
9+
jobs:
10+
build:
11+
name: Build the specification file
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Use Node.js 22
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: 22
21+
cache: 'npm'
22+
cache-dependency-path: 'package-lock.json'
23+
registry-url: 'https://npm.pkg.github.com/'
24+
scope: '@apify-packages'
25+
26+
- name: Enable corepack
27+
run: |
28+
corepack enable
29+
30+
- name: Install Dependencies
31+
run: npm ci --force
32+
env:
33+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
34+
35+
- run: |
36+
npm ci
37+
npm run redoc:test
38+
39+
# - uses: actions/setup-python@v5
40+
# with:
41+
# python-version: '3.10'
42+
# - run: python -m pip install schemathesis==3.35.0

.github/workflows/publish-theme.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ jobs:
1717
with:
1818
fetch-depth: 0
1919

20-
- name: Use Node.js 20
20+
- name: Use Node.js 22
2121
uses: actions/setup-node@v4
2222
with:
23-
node-version: 20
23+
node-version: 22
2424

2525
- name: Check changes in theme
2626
id: changed-theme-files
@@ -39,10 +39,10 @@ jobs:
3939
with:
4040
token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
4141

42-
- name: Use Node.js 20
42+
- name: Use Node.js 22
4343
uses: actions/setup-node@v4
4444
with:
45-
node-version: 20
45+
node-version: 22
4646
cache: 'npm'
4747
cache-dependency-path: 'package-lock.json'
4848
always-auth: 'true'

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ node_modules
66
*.pid
77
*.seed
88
.DS_Store
9-
lib
109
coverage
1110
.nyc_output
12-
logs
1311
pids
1412
.idea
1513
.vscode
1614
yarn.lock
1715
tmp
18-
jsconfig.json
1916
types
2017
.history
2118
.docusaurus
2219
tsconfig.tsbuildinfo
2320
.turbo
21+
sources/api/*
22+
!sources/api/sidebars.js
23+
openapi/openapi.yaml

.redocly.yaml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
1+
# See https://redoc.ly/docs/cli/configuration/ for more information.
2+
apis:
3+
main@v1:
4+
root: openapi/openapi/openapi.yaml
5+
16
extends:
27
- recommended
38

49
rules:
10+
spec: error
511
no-unused-components: error
612

713
theme:
14+
htmlTemplate: openapi/docs/index.html
15+
816
openapi:
9-
requiredPropsFirst: true
10-
noAutoAuth: true
11-
hideDownloadButton: true
12-
onlyRequiredInSamples: true
13-
nativeScrollbars: true
14-
scrollYOffset: 68
15-
colors:
16-
primary:
17-
main: '#1f9ec8'
1817
expandDefaultResponse: true
1918
expandDefaultRequest: true
2019
expandResponses: all
21-
schemaExpansionLevel: 2
22-
jsonSampleExpandLevel: 2
20+
schemasExpansionLevel: 2
21+
jsonSamplesExpandLevel: 2
22+
23+
plugins:
24+
- openapi/plugins/apify.js
25+
26+
decorators:
27+
apify/legacy-doc-url-decorator: on
28+
apify/client-references-links-decorator: on

_typos.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ SER = "SER"
1010

1111
[files]
1212
extend-exclude = ['sources/api/*.mdx']
13+
14+
[files]
15+
extend-exclude = ['sources/api/*.mdx']

apify-docs-theme/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
},
2121
"dependencies": {
2222
"@apify/docs-search-modal": "^1.1.1",
23-
"@docusaurus/theme-common": "3.6.2",
23+
"@docusaurus/theme-common": "3.6.3",
2424
"@stackql/docusaurus-plugin-hubspot": "^1.1.0",
2525
"axios": "^1.7.4",
2626
"babel-loader": "^9.1.3",

apify-docs-theme/src/roa-loader/index.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
1-
const { inspect } = require('util');
1+
const { createHash } = require('node:crypto');
2+
const { inspect } = require('node:util');
23

34
const { urlToRequest } = require('loader-utils');
45

56
const signingUrl = new URL('https://api.apify.com/v2/tools/encode-and-sign');
67
signingUrl.searchParams.set('token', process.env.APIFY_SIGNING_TOKEN);
78
const queue = [];
9+
const cache = {};
810
let working = false;
911

12+
function hash(source) {
13+
return createHash('sha1').update(source).digest('hex');
14+
}
15+
1016
async function getHash(source) {
17+
const cacheKey = hash(source);
18+
19+
if (cache[cacheKey]) {
20+
return cache[cacheKey];
21+
}
22+
1123
const memory = source.match(/playwright|puppeteer/i) ? 4096 : 1024;
1224
const res = await (await fetch(signingUrl, {
1325
method: 'POST',
@@ -25,14 +37,15 @@ async function getHash(source) {
2537
},
2638
})).json();
2739

28-
await new Promise((resolve) => setTimeout(resolve, 100));
29-
3040
if (!res.data || !res.data.encoded) {
3141
// eslint-disable-next-line no-console
3242
console.error(`Signing failed:' ${inspect(res.error) || 'Unknown error'}`, res);
3343
return 'invalid-token';
3444
}
3545

46+
cache[cacheKey] = res.data.encoded;
47+
await new Promise((resolve) => setTimeout(resolve, 100));
48+
3649
return res.data.encoded;
3750
}
3851

@@ -68,7 +81,7 @@ module.exports = async function (code) {
6881

6982
// eslint-disable-next-line no-console
7083
console.log(`Signing ${urlToRequest(this.resourcePath)}...`, { working, queue: queue.length });
71-
const hash = await encodeAndSign(code);
84+
const codeHash = await encodeAndSign(code);
7285

73-
return { code, hash };
86+
return { code, hash: codeHash };
7487
};

docusaurus.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ module.exports = {
181181
config: {
182182
/** @type {import('docusaurus-plugin-openapi-docs').Options} */
183183
v2: {
184-
specPath: 'node_modules/@apify/openapi/openapi.yaml',
184+
specPath: 'openapi.yaml',
185185
outputDir: './sources/api',
186186
sidebarOptions: {
187187
groupPathsBy: 'tag',

0 commit comments

Comments
 (0)