Skip to content

Commit 1097f22

Browse files
B4nanclaude
andauthored
fix(api): Fix boolean query params, search pollution, and OpenAPI schemas (#2207)
## Summary - Fix boolean query parameters showing empty values in API tester (e.g., `?clean=` instead of `?clean=true`) - Move API clients box from markdown injection to direct React rendering with BrowserOnly (fixes search pollution and markdown export) - Move LLM buttons from markdown injection to React portal rendering (fixes search pollution and markdown export) - Add missing properties to OpenAPI schemas to fix @redocly/cli 2.15.0 validation errors - Skip apiKey auth schemes in API tester (only support httpBearer) - Improve response examples display: - Show Example tab first (before Schema) - Skip auto-generated example when explicit example exists - Expand first level of nested schema items by default - Update OpenAPI plugin packages to 4.7.1 and @redocly/cli to 2.15.0 ## Test plan - [x] Test boolean query parameters in API tester (e.g., Dataset items `clean` param) - [x] Verify API clients box renders correctly and doesn't appear in search or `.md` export - [x] Verify LLM buttons render after heading and don't appear in search or `.md` export - [x] Verify API tester only shows Bearer token auth option - [x] Verify response examples show Example tab first with explicit examples preferred - [x] Verify first level of schema is expanded by default - [x] OpenAPI lint passes (`npm run openapi:lint:redocly`) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Closes #2204 Closes #1983 Closes #1943 Closes #1327 Closes #1174 --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent b4c35ab commit 1097f22

22 files changed

Lines changed: 617 additions & 226 deletions

CONTRIBUTING.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,18 +190,22 @@ Content lives in the following locations:
190190
191191
### Overview
192192
193-
The API reference documentation at [docs.apify.com](https://docs.apify.com/) is built directly from our OpenAPI specification. The source of truth for the API specification lives in the `/apify-api/openapi` directory within [apify-docs](https://github.com/apify/apify-docs) repository.
193+
The API reference documentation at [docs.apify.com/api/v2](https://docs.apify.com/api/v2) is built from our OpenAPI specification. The source of truth lives in the `/apify-api/openapi` directory.
194194
195-
### Setup requirements
195+
### Tooling
196196
197-
1. Install Node.js
198-
2. Clone the repository
199-
3. Run `npm install`
197+
We use the following tools for API documentation:
198+
199+
- **[OpenAPI 3.0](https://spec.openapis.org/oas/v3.0.3)** - API specification format
200+
- **[Redocly CLI](https://redocly.com/docs/cli/)** - Linting and validation of OpenAPI specs
201+
- **[`docusaurus-plugin-openapi-docs`](https://github.com/PaloAltoNetworks/docusaurus-openapi-docs)** - Generates MDX docs from OpenAPI
202+
- **[`docusaurus-theme-openapi-docs`](https://github.com/PaloAltoNetworks/docusaurus-openapi-docs)** - Renders API reference with interactive explorer
200203
201204
### Basic commands
202205
203206
- `npm start` - Starts docs preview server including API reference
204-
- `npm test` - Validates the definition
207+
- `npm run openapi:lint:redocly` - Validates OpenAPI spec with Redocly CLI
208+
- `npm run api:rebuild` - Regenerates API docs from OpenAPI specs
205209
206210
### Adding new documentation
207211
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
title: Metamorph
2+
description: Information about a metamorph event that occurred during the run.
3+
type: object
4+
required:
5+
- createdAt
6+
- actorId
7+
- buildId
8+
properties:
9+
createdAt:
10+
type: string
11+
format: date-time
12+
description: Time when the metamorph occurred.
13+
examples: ["2019-11-30T07:39:24.202Z"]
14+
actorId:
15+
type: string
16+
description: ID of the Actor that the run was metamorphed to.
17+
examples: [nspoEjklmnsF2oosD]
18+
buildId:
19+
type: string
20+
description: ID of the build used for the metamorphed Actor.
21+
examples: [ME6oKecqy5kXDS4KQ]
22+
inputKey:
23+
type: [string, "null"]
24+
description: Key of the input record in the key-value store.
25+
examples: [INPUT-METAMORPH-1]

apify-api/openapi/components/schemas/actor-runs/Run.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,10 @@ properties:
128128
anyOf:
129129
- $ref: ./RunUsageUsd.yaml
130130
- type: "null"
131+
metamorphs:
132+
description: List of metamorph events that occurred during the run.
133+
anyOf:
134+
- type: array
135+
items:
136+
$ref: ./Metamorph.yaml
137+
- type: "null"

apify-api/openapi/components/schemas/actor-runs/RunMeta.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,16 @@ type: object
55
properties:
66
origin:
77
$ref: ./RunOrigin.yaml
8+
clientIp:
9+
type: [string, "null"]
10+
description: IP address of the client that started the run.
11+
userAgent:
12+
type: [string, "null"]
13+
description: User agent of the client that started the run.
14+
scheduleId:
15+
type: [string, "null"]
16+
description: ID of the schedule that triggered the run.
17+
scheduledAt:
18+
type: [string, "null"]
19+
format: date-time
20+
description: Time when the run was scheduled.

apify-api/openapi/components/schemas/actors/CreateOrUpdateVersionRequest.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,12 @@ properties:
2121
examples: [latest]
2222
sourceFiles:
2323
$ref: ./VersionSourceFiles.yaml
24+
gitRepoUrl:
25+
type: [string, "null"]
26+
description: URL of the Git repository when sourceType is GIT_REPO.
27+
tarballUrl:
28+
type: [string, "null"]
29+
description: URL of the tarball when sourceType is TARBALL.
30+
gitHubGistUrl:
31+
type: [string, "null"]
32+
description: URL of the GitHub Gist when sourceType is GITHUB_GIST.

apify-api/openapi/components/schemas/actors/Version.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,12 @@ properties:
2424
examples: [latest]
2525
sourceFiles:
2626
$ref: ./VersionSourceFiles.yaml
27+
gitRepoUrl:
28+
type: [string, "null"]
29+
description: URL of the Git repository when sourceType is GIT_REPO.
30+
tarballUrl:
31+
type: [string, "null"]
32+
description: URL of the tarball when sourceType is TARBALL.
33+
gitHubGistUrl:
34+
type: [string, "null"]
35+
description: URL of the GitHub Gist when sourceType is GITHUB_GIST.
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
title: DatasetSchemaValidationError
22
type: object
33
properties:
4-
error:
5-
$ref: ./DatasetSchemaValidationErrorDetails.yaml
4+
type:
5+
type: string
6+
description: The type of the error.
7+
examples: [schema-validation-error]
8+
message:
9+
type: string
10+
description: A human-readable message describing the error.
11+
examples: [Schema validation failed]
12+
data:
13+
$ref: ./SchemaValidationErrorData.yaml

apify-api/openapi/components/schemas/datasets/DatasetSchemaValidationErrorDetails.yaml

Lines changed: 0 additions & 17 deletions
This file was deleted.

apify-api/openapi/components/schemas/request-queues/RequestDraft.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ required:
66
- method
77
type: object
88
properties:
9+
id:
10+
type: string
11+
description: A unique identifier assigned to the request.
12+
examples: [sbJ7klsdf7ujN9l]
913
uniqueKey:
1014
type: string
1115
description: A unique key used for request de-duplication. Requests with the same unique key are considered identical.

apify-api/openapi/components/schemas/store/StoreListActor.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,6 @@ properties:
5353
$ref: ../actors/ActorStats.yaml
5454
currentPricingInfo:
5555
$ref: ./CurrentPricingInfo.yaml
56+
isWhiteListedForAgenticPayment:
57+
type: [boolean, "null"]
58+
description: Whether the Actor is whitelisted for agentic payment processing.

0 commit comments

Comments
 (0)