Skip to content

Introduce JSON Schema–based converter generator#6

Open
akoenig wants to merge 6 commits into
overengineeringstudio:mainfrom
akoenig:generator
Open

Introduce JSON Schema–based converter generator#6
akoenig wants to merge 6 commits into
overengineeringstudio:mainfrom
akoenig:generator

Conversation

@akoenig

@akoenig akoenig commented Apr 6, 2025

Copy link
Copy Markdown
Contributor

This PR introduces a JSON Schema–based generator capable of creating new converter functions for Genie.

The generator can be controlled via the configuration file genie.config.json:

{
  "converters": [
    {
      "id": "package-json",
      "name": "Support for package.json",
      "source": {
        "type": "json-schema",
        "url": "https://json.schemastore.org/package.json"
      },
      "output": {
        "format": "json"
      }
    }
  ]
}

It is possible to add new converters by specifying a JSON Schema URL in this config file. Once a converter is defined here, running ⁠pnpm build will generate it and compile Genie as usual.

After building, the converter can be imported as usual:

import { packageJSON } from '@overengineering/genie'

export default packageJSON({
  // ...
})

Closes #4.

@schickling schickling 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.

  • genie.config.json -> src/generate-plugins.ts
    • bring back support for business logic (e.g. validation)
    • override stringify

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.

JSON Schema Store Code Generator

2 participants