Skip to content
Draft
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
237de51
poc
notrab Jan 19, 2026
9045cc6
dummy preview page
notrab Jan 19, 2026
cc5f236
fix new line
notrab Jan 19, 2026
ddc8bf6
fmt new spec
notrab Jan 19, 2026
9da0a88
update readme for docs site
notrab Jan 20, 2026
3ae1447
Apply suggestions from code review
notrab Jan 20, 2026
61b4438
move generator file
notrab Jan 20, 2026
06c49c5
remove local dev env arg
notrab Jan 20, 2026
66e4b1e
update ci check
notrab Jan 20, 2026
30dff75
lint
notrab Jan 20, 2026
67ff063
fix frozen lock
notrab Jan 20, 2026
c75e78f
lint spec
notrab Jan 20, 2026
aaf1a73
update readme
notrab Jan 20, 2026
80f06e0
add colored diff
notrab Jan 21, 2026
630309f
test diff
notrab Jan 21, 2026
ab5927b
lint
notrab Jan 21, 2026
fa0119d
revert
notrab Jan 21, 2026
bdca6ea
readme
notrab Jan 21, 2026
fac4754
deploy switch
notrab Jan 21, 2026
1973ef6
run the openapi-check
notrab Jan 23, 2026
911bc3c
add changeset
notrab Jan 23, 2026
f1dd11d
continue-on-error
notrab Jan 23, 2026
b1cea1a
update readme structure
notrab Jan 23, 2026
323e565
Merge branch 'main' into openapi-spec-generator
notrab Jan 23, 2026
98bece8
update spec
notrab Jan 23, 2026
f493d51
announce mintlify errors in slack
notrab Jan 25, 2026
3945545
retry on transient errors
notrab Jan 25, 2026
a16f9eb
rename environment variable
notrab Jan 25, 2026
7ad6563
update wording
notrab Jan 25, 2026
91dfe3c
make right config types
notrab Jan 25, 2026
600294a
remove mintlify comment
notrab Jan 25, 2026
21b72af
update readme variable secret comment
notrab Jan 25, 2026
bba27af
add node types
notrab Jan 25, 2026
692a119
update preview text
notrab Jan 25, 2026
b640ca9
rename types
notrab Jan 25, 2026
16a641f
update mintlify deploy failed comment
notrab Jan 25, 2026
87c5180
replace mock databaseurl for openapi generation
notrab Jan 25, 2026
ac91cff
check server readiness
notrab Jan 25, 2026
4e11eb8
update openapi.json
notrab Jan 25, 2026
8ac20f5
update docs
notrab Jan 25, 2026
83ae0ba
apply coderabbit suggestion
notrab Jan 25, 2026
f7d7031
Merge branch 'main' into openapi-spec-generator
notrab Jan 28, 2026
0d1d1d5
revert to simpler times
notrab Jan 28, 2026
367c991
tidy
notrab Jan 28, 2026
ffb49ae
EnsApiConfigInput
notrab Jan 28, 2026
1a94122
add openapi mock config
notrab Jan 28, 2026
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
25 changes: 25 additions & 0 deletions .github/workflows/test_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,32 @@
- uses: ./.github/actions/setup_node_environment
- run: pnpm test

openapi-sync-check:
name: "OpenAPI Spec Sync Check"
runs-on: blacksmith-4vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup_node_environment

- name: Generate OpenAPI spec from production
run: pnpm --filter ensapi openapi:generate

- name: Format generated spec with Biome
run: pnpm biome format --write docs/docs.ensnode.io/openapi.json

- name: Verify OpenAPI spec matches production
run: |
if git diff --exit-code docs/docs.ensnode.io/openapi.json; then
echo "✅ OpenAPI spec is in sync with production"
else
echo "❌ OpenAPI spec is out of sync with production"
echo ""
echo "The committed openapi.json differs from the production API."
echo "Run 'pnpm --filter ensapi openapi:generate' and commit the changes."
exit 1
fi

integrity-check:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium test

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
name: "Integrity Check"
runs-on: blacksmith-4vcpu-ubuntu-2204
services:
Expand Down
3 changes: 2 additions & 1 deletion apps/ensapi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"test": "vitest",
"lint": "biome check --write .",
"lint:ci": "biome ci",
"typecheck": "tsc --noEmit"
"typecheck": "tsc --noEmit",
"openapi:generate": "tsx scripts/generate-openapi.ts"
},
"dependencies": {
"@ensdomains/ensjs": "^4.0.2",
Expand Down
51 changes: 51 additions & 0 deletions apps/ensapi/scripts/generate-openapi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env tsx

/**
* Generate OpenAPI spec from a running ENSApi instance.
*
* Usage:
* pnpm openapi:generate # Uses default URL (production)
* pnpm openapi:generate http://localhost:3223 # Uses custom URL
* ENSAPI_URL=http://localhost:3223 pnpm openapi:generate
*
* Output:
* Writes openapi.json to the docs directory for Mintlify to consume.
* Run `pnpm biome format --write docs/docs.ensnode.io/openapi.json` after to format.
*/

import { writeFileSync } from "node:fs";
import { resolve } from "node:path";

const DEFAULT_ENSAPI_URL = "https://api.alpha.ensnode.io";
const OUTPUT_PATH = resolve(import.meta.dirname, "../../../docs/docs.ensnode.io/openapi.json");

async function main() {
// Get URL from argument or environment variable
const ensapiUrl = process.argv[2] || process.env.ENSAPI_URL || DEFAULT_ENSAPI_URL;
const openapiUrl = `${ensapiUrl}/openapi.json`;

console.log(`Fetching OpenAPI spec from: ${openapiUrl}`);

const response = await fetch(openapiUrl);

if (!response.ok) {
console.error(`Failed to fetch OpenAPI spec: ${response.status} ${response.statusText}`);
process.exit(1);
}

const spec = await response.json();

// Pretty-print the JSON for readability in git diffs
const content = `${JSON.stringify(spec, null, 2)}\n`;

writeFileSync(OUTPUT_PATH, content, "utf-8");

console.log(`OpenAPI spec written to: ${OUTPUT_PATH}`);
console.log(`Spec version: ${spec.info?.version}`);
console.log(`Paths: ${Object.keys(spec.paths || {}).length}`);
}

main().catch((error) => {
console.error("Error generating OpenAPI spec:", error);
process.exit(1);
});
8 changes: 7 additions & 1 deletion docs/docs.ensnode.io/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@
},
{
"group": "API Reference",
"openapi": "https://gist.githubusercontent.com/notrab/94b637e77468cbddd895d7933ce88f64/raw/12cb5ed183558a9bdda5d1c7004db6c794dbd13e/green-ensnode-openapi.json"
"openapi": "https://api.alpha.ensnode.io/openapi.json"
},
{
"group": "Preview",
"pages": ["ensapi/preview"],
"openapi": "./openapi.json",
"hidden": true
}
]
}
Expand Down
9 changes: 9 additions & 0 deletions docs/docs.ensnode.io/ensapi/preview.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: API Preview
sidebarTitle: Preview
description: Preview upcoming API changes from the current branch.
---

This page shows the OpenAPI specification from the current branch, which may include unreleased API changes.

For the production API documentation, see the [API Reference](/ensapi).
Loading
Loading