Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

compile-schemas-to-typescript

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

compile-schemas-to-typescript

Transform a directory of JSON Schems into TypeScript Interfaces

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Compile Schemas to TypeScript

This module is a wrapper around the json-schema-to-typescript library that enables transformation of directories of schemas instead of individual schemas. If directory support is added to the json-schema-to-typescript library this module will be archived.

CLI

This module works as an CLI. Install as a dependency and call compile-schemas-to-typescript from a npm script, or use npx

npx compile-schemas-to-typescript <schema-dir> <types-output-dir>

API

compileSchema(input: string, output: string): Promise<void>

The method iterates over the contents of the input directory and compiles any .json files into TypeScript interfaces and stores the generated output into the specified output directory.

const compileSchemas = require('compile-schemas-to-typescript')

(async () => {
  try {
    await compileSchemas('./schemas', './types')
  } catch (err) {
    console.error(err)
    process.exit(1)
  }
})()

Contributing

This project is actively maintained by the Fastify team.

Contributions are welcome! Please open an issue and a pull request.

License

Licensed under MIT.

Keywords

FAQs

Package last updated on 19 Dec 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc