Comments (4)
Furthermore - what version of quicktype are you using @SaintPepsi ? I am getting:
Error: Option parsing failed: UNKNOWN_OPTION: Unknown option: --combine-files.
from quicktype.
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:
-
Install Quicktype if you haven't already:
npm install -g quicktype
-
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.
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.
@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)
- C++ output with "https://app.quicktype.io/" is very different from the one generated locally with master repo HOT 1
- [BUG]: no quicktype binary for 23.0.159 release
- [BUG]: quicktype version 23.0.161 command not found HOT 3
- [FEATURE]: Swift - Sendable JSONAny HOT 1
- [FEATURE]: Optional Parameters in Dart
- [FEATURE]: "empty" method in Dart
- [BUG]: Cannot fetch external links from $ref due inputStream.once error
- [FEATURE]: Use externally provided class
- [FEATURE]: cJSON - generate source/header pairs
- [FEATURE]: Can we add string to all json types?
- [BUG]: Uncaught ReferenceError: process is not defined in the browser HOT 3
- [BUG]: your dependency on @YousefED/typescript-json-schema depends on old/buggy packages
- [FEATURE]: Optionally append enum type name to Golang enum constants
- [BUG]: Minimum integer values are not handled correctly when generating C++ code.
- [FEATURE]: better separation of types and serialization / deserialilzation code in generated C++ output
- [FEATURE]: CSharp - make emitting DateOnlyConverter & TimeOnlyConverter optional
- [FEATURE]: xml2typescript using quicktype ( doxygen XLST into typescript definitions)
- [BUG]: Unable to handle `string|integer` in JSON schema.
- [BUG]: Generates an extra class if using $refs to URLs that don't exist HOT 1
- [BUG]: Generating from a folder of schema files gives invalid results
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quicktype.