Skip to content

New JSON generator schema #214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task done
flakey5 opened this issue Mar 20, 2025 · 4 comments · May be fixed by #287
Open
1 task done

New JSON generator schema #214

flakey5 opened this issue Mar 20, 2025 · 4 comments · May be fixed by #287
Assignees

Comments

@flakey5
Copy link
Member

flakey5 commented Mar 20, 2025

Enter your suggestions in details:

Background

This issue is regarding the new format for the JSON generator.
It only pertains to the format of the JSON files, the implementation details will be discussed once a censensus is reached here.

Why a new format?

There are a handful of issues with the current format, with some of the main ones being:

  • Maintainability
    • Without a pre-defined schema, it can be harder to tell where a property should be expected to go within the output
    • There isn't a great way to communicate changes to this schema when they happen
  • Consumability
    • Users don't know what to expect without going through the generator's code or looking through all of the outputted JSON files
    • The current format represents some fields in unfortunate ways (i.e. Markdown being parsed in HTML for descriptions)

Relevant: DefinitelyTyped/DefinitelyTyped#70298, #57

The new format

The newly proposed schema for json generator is available here.
An example of it being used for Buffer is available here.

The new proposed schema for the json-all generator is available here.
An example of it being used is available here.

Key Points

JSON Schema

The new formats have JSON schemas defined. This gives us three main advantages over the current format:

  1. Consumers know what to expect
  2. We can version the output files in a standardized way (via the $id property)
  3. The schemas can be used to generate the types used within the JSON generator. This will help with maintaining the generator in the long run since we don't have to worry about them getting out of sync.

JSDoc Property Names

JSDoc keys (i.e. @name, @type) are used in the format.
This is mainly to make the files easier to consume.

TODOs

Here's what's left to be done with the new format:

@flakey5
Copy link
Member Author

flakey5 commented Mar 20, 2025

cc @nodejs/web-infra

@ovflowd
Copy link
Member

ovflowd commented Mar 22, 2025

The newly proposed schema for json generator is available here.
An example of it being used for Buffer is available here.

This looks really good!

@ovflowd
Copy link
Member

ovflowd commented Mar 22, 2025

cc @nodejs/web-infra

I finished giving a look! 👍

@flakey5
Copy link
Member Author

flakey5 commented Mar 22, 2025

cc @nodejs/documentation

flakey5 added a commit that referenced this issue May 31, 2025
@flakey5 flakey5 linked a pull request May 31, 2025 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging a pull request may close this issue.

2 participants