Coder Social home page Coder Social logo

Comments (4)

codan84 avatar codan84 commented on June 19, 2024 1

Furthermore - what version of quicktype are you using @SaintPepsi ? I am getting:

Error: Option parsing failed: UNKNOWN_OPTION: Unknown option: --combine-files.

from quicktype.

SaintPepsi avatar SaintPepsi commented on June 19, 2024

Yes, you can use Quicktype to generate TypeScript interfaces and enums for your JSON schemas. Quicktype supports resolving $ref references to external files, so it should work well for your scenario.

Here's how you can do it:

  1. Install Quicktype if you haven't already:

    npm install -g quicktype
    
  2. Use Quicktype to generate TypeScript interfaces and enums:

    quicktype --src-lang schema --lang ts --combine-files schemas/draft.json schemas/new-draft.json schemas/enums/some-enum.json
    

    This command tells Quicktype to generate TypeScript code (--lang ts) by combining multiple schema files (--combine-files). Replace the file paths with your actual file structure.

Quicktype will then generate a single TypeScript file containing interfaces and enums for each schema, including the referenced enums from enums/some-enum.json. You can then use these TypeScript definitions in your code.

from quicktype.

codan84 avatar codan84 commented on June 19, 2024

Thanks, this unfortunately will explode out of proportion with the number of schemas I am dealing with. Is there no way to automaticaly include all schemas in a directory (recursively)?

from quicktype.

rodcloutier avatar rodcloutier commented on June 19, 2024

@codan84 It seems that you don't need the --combine-files option. Just specifying the files at the command line will combine them in the output.

from quicktype.

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.