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

@json-schema-tools/transpiler

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@json-schema-tools/transpiler

Turn your json schema into typings for various languages. Achieve master class dev tooling.

  • 1.6.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.4K
increased by17.17%
Maintainers
1
Weekly downloads
 
Created
Source

JSON Schema Transpiler

CircleCI branch Dependabot status npm GitHub release GitHub commits since latest release

Turn your JSON Schemas into types to be used in various languages.

Try Me

  • Generate types for:
    • Golang
    • Typescript
    • Rust
    • Python
  • handles cycle detection
  • automatically determines references
  • includes documentation annotations for easy documentation generation with native language tools.
  • minimal dependencies (wip)
  • Creates 1 type alias per 1 schema
  • Autogenerated deterministic titles where missing
  • Autoreferencer (removes duplication)
  • Code is synchronous - no IO keeps it lean and fast
  • Convert schema to types in browser too!

Getting Started

npm install @json-schema-tools/transpiler

const JsonSchemaTranspiler = require("@json-schema-tools/transpiler").default;

const mySchema = {
  "title": "PlowAnimals",
  "description": "an array of animals that are good at pulling things",
  "type": "array",
  "items": {
    "oneOf": [
      { "title": "Horse" },
      { "title": "Donkey" },
      { "title": "Elephant" },
    ]
  }
};

const transpiler = new JsonSchemaTranspiler(mySchema);

console.log(transpiler.toTypescript());
console.log(transpiler.toRust());
console.log(transpiler.to("go")); // same thing, different form/interface
console.log(transpiler.to("python")); // works with shorthand of the language aswell (py or python)

Contributing

How to contribute, build and release are outlined in CONTRIBUTING.md, BUILDING.md and RELEASING.md respectively. Commits in this repository follow the CONVENTIONAL_COMMITS.md specification.

FAQs

Package last updated on 16 Nov 2020

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