Git Product home page Git Product logo

Comments (4)

sparebytes avatar sparebytes commented on May 29, 2024 2

Inspired by this project, I wrote my own transformation plugin that actually generates JSON schema and passes it through AJV for validation. It doesn't emit separate json files but emits it into the javascript. One caveat is that right now each validation function has a full-blown copy of the schema needed. EG if you have validation functions for both interface Animal and interface Cat extends Animal, the Cat validator will contain duplicate JSON Schema code from Animal.

Anyway I'm not attesting to whether my project is any better or worse than this one. The reason I went this route was to make sure my own esoteric use cases are supported. Also by using ts-json-schema-generator it minimizes the code for traversing the the Typescript AST inside my own project.

https://github.com/sparebytes/typesmith

from typescript-is.

woutervh- avatar woutervh- commented on May 29, 2024

Hi @mtiller

Indeed it's a nice way to generate JSON schema consistent with your TypeScript interfaces.
There are already some projects out there that can do this:

Hope this helps :)

from typescript-is.

woutervh- avatar woutervh- commented on May 29, 2024

Sounds useful. Thanks for sharing!

from typescript-is.

woutervh- avatar woutervh- commented on May 29, 2024

Closing for housekeeping.

from typescript-is.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.