Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .github/cli-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 10 additions & 10 deletions .github/cli-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ examples run in the page.
in the tab. [How to set it up](#sign-in-to-oauth-apis).
- **Test and monitor.** The same requests and flows run in CI and against production, with no spec needed, and QA
can run them from a published portal. [How](docs/testing-and-monitoring.md), or on the [docs site](https://docs.specbook.dev/test/).
- **Flows.** Chain requests, capture values from one response into the next, and assert on the way.
- **Flows.** Chain requests, capture values from one response into the next, and assert on the way. A step can also be a
script: code with typed inputs and outputs, such as a payment SDK that needs a browser. A script also runs on its own.
- **Share a view.** A link opens the same operation for someone else, for any spec served from a public address.
- **Embed it.** Serve the viewer from your API's docs route: it runs on your origin, so no CORS, and your
visitors' cookies are sent.
Expand Down
1 change: 1 addition & 0 deletions apps/docs/demo/.specbook/environments/demo.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
petstoreUrl=/api/petstore
countriesUrl=/api/countries
turnstileUrl=/api/turnstile
4 changes: 4 additions & 0 deletions apps/docs/demo/.specbook/specbook.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ export default defineConfig({
// where each API lives by default: the real ones; the `demo` environment points them at this site's own demo API
petstoreUrl: 'https://petstore3.swagger.io/api/v3',
countriesUrl: 'https://countries.trevorblades.com',
turnstileUrl: 'https://challenges.cloudflare.com/turnstile/v0',
// Cloudflare's published test secret: it only accepts the token its test site keys give, and protects nothing
turnstileDummySecret: '1x0000000000000000000000000000000AA',
},
faker: { locales: { en: ['en'], de: ['de', 'en'], ja: ['ja', 'en'] }, default: 'en' },
secrets: { PETSTORE_API_KEY: {} },
services: {
petstore: { spec: './openapi/petstore.json', baseUrl: '{{petstoreUrl}}', auth: 'apiKey' },
countries: { spec: './openapi/countries.json', baseUrl: '{{countriesUrl}}' },
turnstile: { spec: './openapi/turnstile.json', baseUrl: '{{turnstileUrl}}' },
},
auth: {
// The public Petstore documents this header and accepts any value. Its secured operations show it
Expand Down
72 changes: 72 additions & 0 deletions apps/docs/demo/openapi/turnstile.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"openapi": "3.0.3",
"info": {
"title": "Cloudflare Turnstile",
"version": "1.0.0",
"description": "The one call a server makes with the token the Turnstile widget gave a page. Cloudflare answers 200 whether the token is good or not: `success` says which. https://developers.cloudflare.com/turnstile/get-started/server-side-validation/"
},
"servers": [{ "url": "https://challenges.cloudflare.com/turnstile/v0" }],
"paths": {
"/siteverify": {
"post": {
"operationId": "Siteverify",
"summary": "Verify a Turnstile token",
"description": "Checks a token with the site's secret key. Call it from a server: the secret must never reach a browser, so Cloudflare does not allow browsers to read the answer.",
"tags": ["turnstile"],
"requestBody": {
"required": true,
"content": {
"application/x-www-form-urlencoded": {
"schema": { "$ref": "#/components/schemas/SiteverifyRequest" }
}
}
},
"responses": {
"200": {
"description": "The result of the check",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/SiteverifyResponse" },
"example": {
"success": true,
"error-codes": [],
"challenge_ts": "2025-01-01T00:00:00.000Z",
"hostname": "example.com"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"SiteverifyRequest": {
"type": "object",
"required": ["secret", "response"],
"properties": {
"secret": { "type": "string", "description": "The site's secret key." },
"response": { "type": "string", "description": "The token the widget gave the page." },
"remoteip": { "type": "string", "description": "The visitor's address, when you want it checked." },
"idempotency_key": {
"type": "string",
"description": "Lets the same token be checked again, for a retry."
}
}
},
"SiteverifyResponse": {
"type": "object",
"required": ["success", "error-codes"],
"properties": {
"success": { "type": "boolean" },
"error-codes": { "type": "array", "items": { "type": "string" } },
"challenge_ts": { "type": "string", "description": "When the challenge was solved." },
"hostname": { "type": "string", "description": "The site the widget was on." },
"action": { "type": "string" },
"cdata": { "type": "string" }
}
}
}
}
}
Loading
Loading