Skip to content

feat(json): add JSON generators - #1079

Merged
avivkeller merged 2 commits into
mainfrom
json-generators
Sep 22, 2026
Merged

avivkeller merged 2 commits into
mainfrom
json-generators

Conversation

@avivkeller

Copy link
Copy Markdown
Member

This PR is meant to supersede #287 and fix #214.

The majority of the added lines are test fixtures and schemas, so do not be alarmed by the size of this PR.

This new generator writes one JSON document per source file. Each document
is a tree of the file's headings, in document order, with the metadata,
signature or type, Markdown body, and code examples of every one of them.

The output is described by a JSON schema, published at the URL every document
carries in $schema, and shipped with the package as
@doc-kit/core/generators/json/schema.json.

An output looks roughly like:

{
  "$schema": "https://doc-kit.nodejs.org/schemas/api-doc/1.0.0.json",
  "id": "fs",
  "path": "/fs",
  "type": "module",
  "module": "fs",
  "title": "File system",
  "introducedIn": "v0.10.0",
  "sourceLink": {
    "path": "lib/fs.js",
    "url": "https://github.com/nodejs/node/blob/HEAD/lib/fs.js"
  },
  "stability": { "index": "2","description": "Stable" },
  "added": [],
  "deprecated": [],
  "removed": [],
  "napiVersion": [],
  "changes": [],
  "description": "The `node:fs` module enables interacting with the file system in a\nway modeled on standard POSIX functions.\n\n",
  "summary": "The `node:fs` module enables interacting with the file system in a way modeled on standard POSIX functions.",
  "examples": [],
  "children": []
}

@avivkeller
avivkeller requested a review from a team as a code owner September 2, 2026 22:36
@vercel

vercel Bot commented Sep 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
api-docs-tooling Ready Ready Preview Sep 22, 2026 7:48pm UTC

Request Review

@codecov

codecov Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.71287% with 83 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.38%. Comparing base (2611469) to head (cf5e7bb).

Files with missing lines Patch % Lines
packages/core/src/generators/json/generate.mjs 38.46% 40 Missing ⚠️
www/doc-kit.config.mjs 0.00% 14 Missing ⚠️
packages/react/src/jsx-ast/utils/buildContent.mjs 33.33% 6 Missing ⚠️
...ckages/core/src/generators/json/utils/document.mjs 91.37% 4 Missing and 1 partial ⚠️
scripts/generate-json-types.mjs 90.19% 5 Missing ⚠️
packages/core/src/generators/json-all/generate.mjs 91.42% 3 Missing ⚠️
...kages/core/src/generators/json/utils/signature.mjs 98.91% 1 Missing and 1 partial ⚠️
...kages/core/src/generators/json-simple/generate.mjs 50.00% 1 Missing ⚠️
...kages/core/src/generators/json/utils/lifecycle.mjs 98.36% 1 Missing ⚠️
...ckages/core/src/generators/json/utils/markdown.mjs 98.24% 0 Missing and 1 partial ⚠️
... and 5 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1079      +/-   ##
==========================================
+ Coverage   90.77%   91.38%   +0.61%     
==========================================
  Files         221      249      +28     
  Lines       21267    23253    +1986     
  Branches     2003     2244     +241     
==========================================
+ Hits        19305    21250    +1945     
- Misses       1956     1994      +38     
- Partials        6        9       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

api-links Generator

Performance estimate (single CI run)

  • Generation time: 55.2% slower (960.00 ms → 1.49 s)
  • Peak memory: 0.9% higher (438.37 MB → 442.48 MB)

legacy-html Generator

Performance estimate (single CI run)

  • Generation time: 28.4% slower (40.46 s → 51.96 s)
  • Peak memory: 1.1% higher (2.36 GB → 2.38 GB)

legacy-json Generator

Performance estimate (single CI run)

  • Generation time: 4.9% faster (8.79 s → 8.36 s)
  • Peak memory: 4.3% higher (1.50 GB → 1.56 GB)

llms-txt Generator

Performance estimate (single CI run)

  • Generation time: 55.1% slower (5.06 s → 7.85 s)
  • Peak memory: 1.1% lower (1.61 GB → 1.59 GB)

orama-db Generator

Output size: 1 file changed · net +129.00 B

File size details
File Main PR Change
orama-db.json 9.50 MB 9.50 MB +129.00 B (+0.0%)

Performance estimate (single CI run)

  • Generation time: 37.5% faster (8.85 s → 5.53 s)
  • Peak memory: 16.1% higher (1.56 GB → 1.81 GB)

web Generator

Output size: 60 files changed · net 0 B

File size details
File Main PR Change
assets/SearchBox-Dn4L8Iad.js 84.60 KB -84.60 KB (-100.0%)
assets/SearchBox-xWxQEwJG.js 84.60 KB +84.60 KB
assets/dist-Bjw0z_pG.js 30.42 KB -30.42 KB (-100.0%)
assets/dist-B6Cxpm1h.js 30.42 KB +30.42 KB
assets/SideBar-8MuLGqIk.js 25.64 KB -25.64 KB (-100.0%)
assets/SideBar-CXDS9lwB.js 25.64 KB +25.64 KB
assets/config-ngHjfxzr.js 24.37 KB -24.37 KB (-100.0%)
assets/config-Cx-IX3nR.js 24.37 KB +24.37 KB
assets/client-7SazmsOY.js 21.59 KB -21.59 KB (-100.0%)
assets/client-Dq0Q6MAq.js 21.59 KB +21.59 KB
assets/Combination-DdLOmvYU.js 16.12 KB -16.12 KB (-100.0%)
assets/Combination-CHXR84A0.js 16.12 KB +16.12 KB
assets/ThemeToggle-ZtCCfTq-.js 13.64 KB -13.64 KB (-100.0%)
assets/ThemeToggle-DDz9c6ru.js 13.64 KB +13.64 KB
assets/dist-CK29K0_0.js 10.20 KB -10.20 KB (-100.0%)
assets/dist-B8-MMbUy.js 10.20 KB +10.20 KB
assets/Layout-CN-724jv.js 10.14 KB -10.14 KB (-100.0%)
assets/Layout-CUfyk3qZ.js 10.14 KB +10.14 KB
assets/compat-BidiPOjp.js 10.12 KB -10.12 KB (-100.0%)
assets/compat-BOvxfbHG.js 10.12 KB +10.12 KB
assets/Tooltip-C2M2o9hk.js 7.93 KB -7.93 KB (-100.0%)
assets/Tooltip-CCL7e45H.js 7.93 KB +7.93 KB
assets/dist-DqDvsSlc.js 6.99 KB -6.99 KB (-100.0%)
assets/dist-vvnfrFEG.js 6.99 KB +6.99 KB
assets/jsx-runtime-D2-vQAkS.js 5.67 KB -5.67 KB (-100.0%)
assets/jsx-runtime-Suavd6wv.js 5.67 KB +5.67 KB
assets/dist-BXWGsdq5.js 3.94 KB -3.94 KB (-100.0%)
assets/dist-CW18yqev.js 3.94 KB +3.94 KB
assets/CodeTabs-CibKMLFc.js 3.89 KB -3.89 KB (-100.0%)
assets/CodeTabs-Bddfa2sD.js 3.89 KB +3.89 KB
assets/CodeBox-DPh2JTJn.js 3.44 KB -3.44 KB (-100.0%)
assets/CodeBox-nTFnhk5t.js 3.44 KB +3.44 KB
assets/hooks.module-CamFfzz1.js 3.40 KB -3.40 KB (-100.0%)
assets/hooks.module-s9wfDDNr.js 3.40 KB +3.40 KB
assets/FunctionSignature-CpjW9Kse.js 2.28 KB -2.28 KB (-100.0%)
assets/FunctionSignature-BEojS7IQ.js 2.28 KB +2.28 KB
assets/Banner-Bq6DJTEX.js 2.19 KB -2.19 KB (-100.0%)
assets/Banner-DlFTTX0X.js 2.19 KB +2.19 KB
assets/ChangeHistory-n7sQS4Vy.js 1.77 KB -1.77 KB (-100.0%)
assets/ChangeHistory-BX3eIUtk.js 1.77 KB +1.77 KB
assets/DataTag-BZCfQQtz.js 844.00 B -844.00 B (-100.0%)
assets/DataTag-C8_euUlY.js 844.00 B +844.00 B
assets/DocumentationIndex-axKKpb-8.js 833.00 B -833.00 B (-100.0%)
assets/DocumentationIndex-DwduBlD_.js 833.00 B +833.00 B
assets/ArrowUpRightIcon-DuQb37F_.js 618.00 B -618.00 B (-100.0%)
assets/ArrowUpRightIcon-BbHDY9iR.js 618.00 B +618.00 B
assets/Badge-B85_1cOt.js 607.00 B -607.00 B (-100.0%)
assets/Badge-Dox463y7.js 607.00 B +607.00 B
assets/AlertBox-CjB-YooR.js 591.00 B -591.00 B (-100.0%)
assets/AlertBox-8KlJ1j1V.js 591.00 B +591.00 B
assets/CodeBracketIcon-Dvb-JilH.js 512.00 B -512.00 B (-100.0%)
assets/CodeBracketIcon-YqUexKPH.js 512.00 B +512.00 B
assets/dist-KTKwpwvA.js 477.00 B -477.00 B (-100.0%)
assets/dist-Bxf_F6I7.js 477.00 B +477.00 B
assets/ChevronDownIcon-CIlTAhga.js 468.00 B -468.00 B (-100.0%)
assets/ChevronDownIcon-H-5RUINM.js 468.00 B +468.00 B
assets/Blockquote-B3PQ_AxW.js 167.00 B -167.00 B (-100.0%)
assets/Blockquote-BQu1Urbw.js 167.00 B +167.00 B
assets/withIsland-Bq2J4i7S.js 105.00 B -105.00 B (-100.0%)
assets/withIsland-EGolLQug.js 105.00 B +105.00 B

Performance estimate (single CI run)

  • Generation time: 4.3% slower (62.00 s → 64.66 s)
  • Peak memory: 10.3% higher (3.21 GB → 3.54 GB)

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 2, 2026

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Failed ❌

View logs ↗
cf5e7bb 2026-09-22T19:47:58.083Z View logs ↗
  • Build: Failed ❌

View logs ↗
a00a55a 2026-09-21T14:26:32.099Z View logs ↗
  • Build: Failed ❌

View logs ↗
7df595e 2026-09-02T22:39:07.083Z View logs ↗

Comment thread packages/core/src/generators/json-all/constants.mjs
@avivkeller

Copy link
Copy Markdown
Member Author

Bump @nodejs/web for reviews

Comment thread packages/core/src/generators/json/__tests__/generate.test.mjs
Comment thread packages/core/src/generators/json/README.md
@ovflowd

ovflowd commented Sep 7, 2026

Copy link
Copy Markdown
Member

@avivkeller reviews on this will take a bit of time, this PR touchjes 68 files, it is... expected for this to... be complex to review 🙇

@avivkeller

Copy link
Copy Markdown
Member Author

Bump!

Comment thread packages/core/src/generators/json/__tests__/schema.test.mjs
Comment thread packages/core/src/generators/json/generated/schema.d.ts
Comment thread packages/core/src/generators/json/utils/document.mjs
Comment thread packages/core/src/generators/json/utils/document.mjs
Comment thread packages/core/src/generators/json/utils/entry.mjs
Comment thread packages/core/src/generators/json/utils/entry.mjs
Comment thread packages/core/src/generators/json/utils/node.mjs
Comment thread packages/core/src/generators/json/utils/node.mjs
Comment thread packages/core/src/generators/json/utils/signature.mjs
Comment thread packages/core/src/generators/json/utils/types.mjs
Comment thread packages/core/src/generators/json/constants.mjs
Comment thread packages/core/src/generators/json/constants.mjs
Comment thread packages/core/src/utils/stability.mjs
Comment thread scripts/generate-json-types.mjs
Comment thread package.json

@ovflowd ovflowd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking really good. Left a few comments, I left out more specific nits, to let this move forward. If you could address my current comments I believe I'm good with a ✔️

@ovflowd

ovflowd commented Sep 19, 2026

Copy link
Copy Markdown
Member

Can you also rebase, @avivkeller?

Co-Authored-By: flakey5 <73616808+flakey5@users.noreply.github.com>
Signed-off-by: avivkeller <me@aviv.sh>

@ovflowd ovflowd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last comment to be addressed, feel free to merge after that. SGTM!

Comment thread packages/core/src/generators/json-all/schema.json Outdated
Comment thread packages/core/src/generators/json-all/schema.json Outdated
Comment thread packages/core/src/generators/json-all/types.d.ts Outdated
Comment thread packages/core/src/generators/json-simple/generate.mjs Outdated
Comment thread packages/core/src/generators/json/generated/schema.d.ts
Comment thread packages/core/src/generators/json/constants.mjs Outdated
Comment thread packages/core/src/generators/json/constants.mjs
Comment thread packages/core/src/generators/json/README.md Outdated
Comment thread README.md

@bmuenzenmeyer bmuenzenmeyer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only wonder if we should add something to the specification or CONTRIBUTING.md to now mention that the schema version spans multiple location

@avivkeller
avivkeller merged commit c4ec767 into main Sep 22, 2026
24 of 27 checks passed
@avivkeller
avivkeller deleted the json-generators branch September 22, 2026 20:07
@github-actions github-actions Bot mentioned this pull request Sep 22, 2026

This branch was successfully deployed

1 active deployment
Preview – api-docs-tooling cf5e7bb3 Deployed Sep 22, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New JSON generator schema

4 participants