Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V15 #1

Open
wants to merge 132 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
132 commits
Select commit Hold shift + click to select a range
f943f32
upgrade json-schema-ref-parser -> 9.0.9
May 15, 2022
6fbcbc8
Optimize optimizer to avoid deep JSON serialization (fix #422)
May 15, 2022
ed417b0
Merge pull request #447 from bcherny/perf/optimize-optimizer
bcherny May 15, 2022
8b3267f
upgrade deps
May 15, 2022
59747b1
Add additionalProperties option (fix #335)
May 15, 2022
966cca5
drop support for node v10
May 15, 2022
603773f
Merge pull request #448 from bcherny/drop-node-10
bcherny May 15, 2022
4837ef2
cleanup: kill mapDeep
May 16, 2022
a89ffe1
Add reasonable max for tuple types (fix #438)
May 16, 2022
a7d14c4
Merge pull request #451 from bcherny/438
bcherny May 22, 2022
b78a616
Bugfix: make compile() non-mutating (fix #370, fix #443)
May 22, 2022
7aa353d
Bugfix: Add support for dollar-id in sub-schemas (fix #436)
May 22, 2022
e65ad1f
Merge pull request #452 from bcherny/436
bcherny May 22, 2022
82fa551
Bump .nvmrc
queengooborg Jun 7, 2022
9212a77
Merge pull request #455 from queengooborg/patch-1
bcherny Jun 11, 2022
d8592cd
sort paths returned by getPaths
Karel-Kroeze Apr 21, 2021
8bdef9a
🧹 Updated snapshots with new file order
s-weigand Jun 26, 2022
d348981
use double quotes for glob patterns
Karel-Kroeze Apr 21, 2021
8fa728e
🩹Only use posix paths for cross platform compatibility
s-weigand Jun 26, 2022
0df0664
Merge pull request #464 from s-weigand/cross-platform-tests-rebased
bcherny Jun 27, 2022
224a352
cleanup: update to namespaced json-schema-ref-parser package name
Jun 29, 2022
e82df8e
cleanup: kill vestigial verbose flag for ava
Jun 29, 2022
a92d7c9
cleanup: downgrade glob version to avoid peerDependency warning
Jun 29, 2022
2ca6e50
Fix cycles during generating (fix #376, fix #323)
May 22, 2022
c6676b6
Merge pull request #453 from bcherny/376
bcherny Jun 29, 2022
65a8239
11.0.0
Jun 29, 2022
2b70bc3
fix broken dependency (fix #465)
Jul 1, 2022
ab60479
11.0.1
Jul 1, 2022
b2027df
fix commit sha for json-schema-ref-parser dep
Jul 1, 2022
efc311a
Update README.md
bcherny Jul 1, 2022
84c9db1
Use forked json-schema-ref-parser (fix #469)
Aug 6, 2022
8c1860c
un-ignore realWorld.fhir test
Aug 6, 2022
c7590c5
11.0.2
Aug 6, 2022
97e562f
fix: replace TSLint disables with ESLint
JoshuaKGoldberg Aug 6, 2022
1a45ce3
Merge pull request #474 from JoshuaKGoldberg/eslint-not-tslint
bcherny Aug 7, 2022
dc0f63f
add test for #135
Aug 7, 2022
34de194
cleanup: use defs internally, not definitions
Aug 7, 2022
2083db1
[Chore] Prepare for yarn3
Aug 13, 2022
864e1cb
Merge branch 'master' of github.com:bcherny/json-schema-to-typescript
Aug 26, 2022
69a393a
Fix strictIndexSignature with standalone types
mrcljx Nov 17, 2021
9a8925d
Fixed eslint extension setting
tlahav Oct 18, 2022
94bd13a
Add MIT License
YairHalberstadt Nov 16, 2022
7e6c2b4
fix type error in normalizer
bcherny Jan 21, 2023
f87aad4
fix readme build badge
bcherny Jan 21, 2023
137f6a7
switch back to standard json-schema-ref-parser release, now that json…
bcherny Jan 21, 2023
f8982cc
add never schema type
notaphplover Feb 5, 2023
4b01877
fix: update parser to parse enum values as literals
notaphplover Feb 6, 2023
1385ef5
Merge pull request #495 from YairHalberstadt/patch-1
bcherny Feb 19, 2023
7583a25
rename LICENSE -> LICENSE.md
Feb 19, 2023
351ee06
Merge pull request #493 from tlahav/fix-eslint-settings
bcherny Feb 19, 2023
eb15918
lock jsrp minor version (see https://github.com/APIDevTools/json-sche…
Feb 19, 2023
8842142
add read-through network cache to improve test reliability
Feb 19, 2023
8ca8217
11.0.4
Feb 19, 2023
810ef47
rm extra logging
Feb 19, 2023
5a9a5bb
Merge branch 'master' of https://github.com/bcherny/json-schema-to-ty…
notaphplover Feb 20, 2023
cea04ae
test: update enum case with additional members
notaphplover Feb 20, 2023
e653ab3
switch back to forked jsrp, with patched minimum node version
Feb 23, 2023
de9b027
11.0.5
Feb 23, 2023
b73e1c7
Merge pull request #509 from notaphplover/fix/parse-enum-values-as-li…
bcherny Feb 23, 2023
6e3fbca
12.0.0
Feb 23, 2023
d81f3dc
Merge branch 'master' of https://github.com/bcherny/json-schema-to-ty…
notaphplover Feb 23, 2023
c4b7639
refactor: add isBoolean util function
notaphplover Feb 23, 2023
e291034
fix: update parser to correctly parse boolean json schemas
notaphplover Feb 23, 2023
e977383
style: fix format errors
notaphplover May 2, 2023
b1f9f3a
style: apply suggestion
notaphplover May 2, 2023
05b0103
Merge pull request #515 from notaphplover/fix/boolean-json-schemas
bcherny May 4, 2023
413517d
add test for additionalProperties CLI flag
bcherny May 4, 2023
8f973d1
Merge pull request #423 from mrcljx/mrcljx/fix-strict-index-signature…
bcherny May 4, 2023
4d0176f
fix tests
bcherny May 4, 2023
20c7f1f
13.0.0
bcherny May 4, 2023
dc366e6
fix boolean cli flags (fix #524)
bcherny May 4, 2023
33aa09d
13.0.1
bcherny May 4, 2023
c04143c
[Bugfix] fix emission for unnamed enums in arrays (fix #530)
Jun 10, 2023
f43ab4c
v13.0.2
Jun 10, 2023
f797848
Add support for deprecated keyword (Fixes #441) (#542)
TravisChong Aug 27, 2023
c826963
cleanup
bcherny Aug 27, 2023
a104878
add format command
bcherny Aug 27, 2023
aebe91e
autoformat everything
bcherny Aug 27, 2023
fe580b6
run formatting check as part of ci
bcherny Aug 27, 2023
34cb853
only format src/ and test/
bcherny Aug 27, 2023
699eda8
13.1.0
bcherny Aug 27, 2023
2887a52
Fix crash when a field has 'deprecated', but not 'description' (#549)
danmichaelo Aug 29, 2023
3bb5d2b
13.1.1
bcherny Aug 29, 2023
bf63b97
rm yarn.lock (fix #569)
bcherny Jan 14, 2024
569f492
[Bugfix] Fix comment emmission for closing comments in patternPropert…
bcherny Jan 14, 2024
6adcad9
v13.1.2
bcherny Jan 14, 2024
7321597
Require Node v16+
bcherny Mar 2, 2024
5369633
Target ES6
bcherny Mar 2, 2024
d92b06e
Switch to @apidevtools/json-schema-ref-parser
bcherny Mar 2, 2024
4f47952
[Chore] Update dependencies
bcherny Apr 20, 2024
7c9ecd7
[Chore] Update dev dependencies (fix #587)
bcherny Apr 20, 2024
9cbe26e
Optimize array output (fix #583)
bcherny Apr 20, 2024
e39ed18
[Docs] Add badge for node version
bcherny Apr 20, 2024
11879fa
[Docs] Update author URL in package.json
bcherny Apr 20, 2024
2f29f19
feat: support `customName` options (#585)
antfu Apr 21, 2024
5f3039a
[Chore] Downgrade ESLint -> 8.56.0
Apr 21, 2024
f97ec06
[Docs] Document customName option in readme
Apr 21, 2024
d97768e
14.0.1
Apr 21, 2024
9ec0c70
feat: [577] Add yml support (#588)
alexanderkrum Apr 21, 2024
13806bd
[Chore] Drop @types/prettier dependency. (#594)
pcorpet Apr 23, 2024
872a057
[Chore] Clean up yaml parsing
bcherny May 2, 2024
e53bb80
[Chore] Clean up legacy style imports
bcherny May 2, 2024
add8ee1
[CI] Modernize Github workflow
bcherny May 2, 2024
2b61748
[CI] Add package-lock.json
bcherny May 2, 2024
39dd574
v14.0.2
bcherny May 2, 2024
107c338
v14.0.3
bcherny May 2, 2024
c9680db
[Docs] Clean up readme
bcherny May 2, 2024
e8291d7
v14.0.4
bcherny May 2, 2024
6c69141
Improve CLI docs
bcherny May 5, 2024
49fb14d
"JSONSchema" -> "JSON Schema"
bcherny May 12, 2024
5d24faa
Update README.md: fix definition of customName (#596)
archiloque Jun 2, 2024
b7fee29
Add yaml support in cli (fix #598)
bcherny Jun 2, 2024
89a7b32
v14.0.5
bcherny Jun 2, 2024
fcb6f73
[Chore] rm .yarn
bcherny Jun 20, 2024
31993de
[Chore] Remove dependency on mz
bcherny Jun 20, 2024
74d6126
[chore] Clean up types
bcherny Jun 25, 2024
3e2e1e9
Add option to generate TS string enums (#578)
codan84 Jun 25, 2024
6fc74b3
v14.1.0
bcherny Jun 25, 2024
e0a822f
clean up types for isSchemaLike
bcherny Jun 26, 2024
62cc052
Intersection schema generation is order-dependent (#603)
altearius Jul 22, 2024
402e188
v15.0.0
bcherny Jul 22, 2024
7c6bad4
add test case for #613
bcherny Aug 12, 2024
17dc5ed
Remove unused dependency (#617)
benmccann Aug 17, 2024
cb99ce4
fix build (#621)
benmccann Aug 20, 2024
c09dbcd
[pruning] move cli-color to devDependencies
bcherny Aug 21, 2024
a1d22d8
[pruning] move @types/lodash to devDependencies
bcherny Aug 21, 2024
108f144
[pruning] rm mkdirp dependency (fix #618)
bcherny Aug 21, 2024
23ce160
15.0.1
bcherny Aug 21, 2024
0f5eacc
move @types/lodash back to dependencies (fix #625)
bcherny Aug 30, 2024
118d6a8
v15.0.2
bcherny Aug 30, 2024
f1084ca
Update to v15
incompl Oct 18, 2024
046a3dc
wi
incompl Oct 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": ["prettier/@typescript-eslint", "plugin:prettier/recommended"],
"extends": ["prettier", "plugin:prettier/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,23 @@ on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
node-version: [10.x, 12.x, 13.x]
node-version: [16.x, 17.x, 18.x, 19.x, 20.x, 21.x]
os: [ubuntu-latest, windows-latest, macOS-latest]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: yarn install --ignore-engines --verbose
run: npm ci
- name: Run tests
run: yarn test
run: npm test
env:
CI: true
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
.DS_Store
.idea/
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
npm-debug.log
node_modules
*.js
*.map
dist/
dist_tests/
package-lock.json
yarn-error.log
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.3.0
16
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"printWidth": 120,
"semi": false,
"singleQuote": true,
"trailingComma": "none",
"trailingComma": "all",
"useTabs": false,
"arrowParens": "avoid"
}
55 changes: 55 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,61 @@

*Note: This is a partial changelog, covering significant & breaking changes. For a full list of changes, please consult the [commit log](https://github.com/bcherny/json-schema-to-typescript/commits).

## 15.0.0

- 62cc052 Fixed bug where intersection schemas didn't generate complete types. Improved output readability for intersection types (#603)

## 14.1.0

- 3e2e1e9 Added `inferStringEnumKeysFromValues` option (#578)

## 14.0.5

- b7fee29 Added .yaml support for CLI (#598)

## 14.0.2

- 9ec0c70 Added .yaml support (#577)

## 14.0.1

- 2f29f19 Added `customName` option

## 14.0.0

- 967eb13 Require Node v16+

## 13.1.0

- f797848 Feat: Add support for `deprecated` keyword

## 13.0.1

- b13a6f2 Bugfix: Boolean CLI flags were not respected (#524)

## 13.0.0

- 05b0103 Bugfix: Parse boolean schemas as schemas, rather than as literals (#515)
- 8f973d1 Bugfix: Fix edge case where emitted names were corrupted when using `strictIndexSignature` (#423)

## 12.0.0

- b73e1c7 Bugfix: Parse enums as literals, rather than as schemas (#508)

## 11.0.0

This is a major release with lots of bugfixes, some of which may change emitted types.

- 2ca6e50 Bugfix: Fix crash that may happen when emitting types for cyclical schemas (#323, #376)
- 8fa728e Bugfix: Fix tests on Windows, make snapshot ordering consistent
- b78a616 Bugfix: Make `compile()` non-mutating (#370, #443)
- a89ffe1 Bugfix: Add maximum size heuristic for tuple types (#438)
- 6fbcbc8 Bugfix: Improve performance & stability issue caused by JSON serialization (#422)
- 7aa353d Feat: Add support for `$id` (#436)
- 59747b1 Feat: Add support for specifying a default for `additionalProperties` (#335)
- 966cca5 Cleanup: Drop support for Node 10


## 10.1.0

- ec78099 Feat: Add support for JSON Schema `const` and `$defs` keywords (#263)
Expand Down
7 changes: 7 additions & 0 deletions LICENCE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2022 Boris Cherny

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
115 changes: 74 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
# json-schema-to-typescript [![Build Status][build]](https://github.com/bcherny/json-schema-to-typescript/actions?query=branch%3Amaster+workflow%3ACI) [![npm]](https://www.npmjs.com/package/json-schema-to-typescript) [![mit]](https://opensource.org/licenses/MIT)
# json-schema-to-typescript [![Build Status][build]](https://github.com/bcherny/json-schema-to-typescript/actions?query=branch%3Amaster+workflow%3ACI) [![npm]](https://www.npmjs.com/package/json-schema-to-typescript) [![mit]](https://opensource.org/licenses/MIT) ![node]

[build]: https://img.shields.io/github/workflow/status/bcherny/json-schema-to-typescript/CI/master?style=flat-square
[build]: https://img.shields.io/github/actions/workflow/status/bcherny/json-schema-to-typescript/ci.yml?style=flat-square
[npm]: https://img.shields.io/npm/v/json-schema-to-typescript.svg?style=flat-square
[mit]: https://img.shields.io/npm/l/json-schema-to-typescript.svg?style=flat-square
[node]: https://img.shields.io/badge/Node.js-16+-417e37?style=flat-square

> Compile json schema to typescript typings
> Compile JSON Schema to TypeScript typings.

## Example

Check out the [live demo](https://borischerny.com/json-schema-to-typescript-browser/).

Input:

```json
{
"title": "Example Schema",
Expand Down Expand Up @@ -36,6 +40,7 @@ Input:
```

Output:

```ts
export interface ExampleSchema {
firstName: string;
Expand All @@ -51,15 +56,59 @@ export interface ExampleSchema {
## Installation

```sh
# Using Yarn:
yarn add @takeshape/json-schema-to-typescript

# Or, using NPM:
npm install @takeshape/json-schema-to-typescript --save
npm install @takeshape/json-schema-to-typescript
```

## Usage

json-schema-to-typescript is easy to use via the CLI, or programmatically.

### CLI

First make the CLI available using one of the following options:

```sh
# install locally, then use `npx json2ts`
npm install json-schema-to-typescript

# or install globally, then use `json2ts`
npm install json-schema-to-typescript --global

# or install to npm cache, then use `npx --package=json-schema-to-typescript json2ts`
# (you don't need to run an install command first)
```

Then, use the CLI to convert JSON files to TypeScript typings:

```sh
cat foo.json | json2ts > foo.d.ts
# or
json2ts foo.json > foo.d.ts
# or
json2ts foo.yaml foo.d.ts
# or
json2ts --input foo.json --output foo.d.ts
# or
json2ts -i foo.json -o foo.d.ts
# or (quote globs so that your shell doesn't expand them)
json2ts -i 'schemas/**/*.json'
# or
json2ts -i schemas/ -o types/
```

You can pass any of the options described below (including style options) as CLI flags. Boolean values can be set to false using the `no-` prefix.

```sh
# generate code for definitions that aren't referenced
json2ts -i foo.json -o foo.d.ts --unreachableDefinitions
# use single quotes and disable trailing semicolons
json2ts -i foo.json -o foo.d.ts --style.singleQuote --no-style.semi
```

### API

To invoke json-schema-to-typescript from your TypeScript or JavaScript program, import it and call `compile` or `compileFromFile`.

```js
import { compile, compileFromFile } from 'json-schema-to-typescript'

Expand All @@ -83,50 +132,28 @@ See [server demo](example) and [browser demo](https://github.com/bcherny/json-sc

| key | type | default | description |
|-|-|-|-|
| bannerComment | string | `"/* tslint:disable */\n/**\n* This file was automatically generated by json-schema-to-typescript.\n* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,\n* and run json-schema-to-typescript to regenerate this file.\n*/"` | Disclaimer comment prepended to the top of each generated file |
| additionalProperties | boolean | `true` | Default value for `additionalProperties`, when it is not explicitly set |
| bannerComment | string | `"/* eslint-disable */\n/**\n* This file was automatically generated by json-schema-to-typescript.\n* DO NOT MODIFY IT BY HAND. Instead, modify the source JSON Schema file,\n* and run json-schema-to-typescript to regenerate this file.\n*/"` | Disclaimer comment prepended to the top of each generated file |
| customName | `(LinkedJSONSchema, string \| undefined) => string \| undefined` | `undefined` | Custom function to provide a type name for a given schema
| cwd | string | `process.cwd()` | Root directory for resolving [`$ref`](https://tools.ietf.org/id/draft-pbryan-zyp-json-ref-03.html)s |
| declareExternallyReferenced | boolean | `true` | Declare external schemas referenced via `$ref`? |
| enableConstEnums | boolean | `true` | Prepend enums with [`const`](https://www.typescriptlang.org/docs/handbook/enums.html#computed-and-constant-members)? |
| inferStringEnumKeysFromValues | boolean | `false` | Create enums from JSON enums with eponymous keys |
| format | boolean | `true` | Format code? Set this to `false` to improve performance. |
| ignoreMinAndMaxItems | boolean | `false` | Ignore maxItems and minItems for `array` types, preventing tuples being generated. |
| maxItems | number | `20` | Maximum number of unioned tuples to emit when representing bounded-size array types, before falling back to emitting unbounded arrays. Increase this to improve precision of emitted types, decrease it to improve performance, or set it to `-1` to ignore `maxItems`.
| strictIndexSignatures | boolean | `false` | Append all index signatures with `\| undefined` so that they are strictly typed. |
| style | object | `{ bracketSpacing: false, printWidth: 120, semi: true, singleQuote: false, tabWidth: 2, trailingComma: 'none', useTabs: false }` | A [Prettier](https://prettier.io/docs/en/options.html) configuration |
| unknownAny | boolean | `true` | Use `unknown` instead of `any` where possible |
| unreachableDefinitions | boolean | `false` | Generates code for `definitions` that aren't referenced by the schema. |
| strictIndexSignatures | boolean | `false` | Append all index signatures with `\| undefined` so that they are strictly typed. |
| $refOptions | object | `{}` | [$RefParser](https://github.com/BigstickCarpet/json-schema-ref-parser) Options, used when resolving `$ref`s |
## CLI

A CLI utility is provided with this package.

```sh
cat foo.json | json2ts > foo.d.ts
# or
json2ts foo.json > foo.d.ts
# or
json2ts foo.json foo.d.ts
# or
json2ts --input foo.json --output foo.d.ts
# or
json2ts -i foo.json -o foo.d.ts
# or (quote globs so that your shell doesn't expand them)
json2ts -i 'schemas/**/*.json'
# or
json2ts -i schemas/ -o types/
```
| unreachableDefinitions | boolean | `false` | Generates code for `$defs` that aren't referenced by the schema. |
| $refOptions | object | `{}` | [$RefParser](https://github.com/APIDevTools/json-schema-ref-parser) Options, used when resolving `$ref`s |

You can pass any of the options described above (including style options) as CLI flags. Boolean values can be set to false using the `no-` prefix.
## Tests

```sh
# generate code for definitions that aren't referenced
json2ts -i foo.json -o foo.d.ts --unreachableDefinitions
# use single quotes and disable trailing semicolons
json2ts -i foo.json -o foo.d.ts --style.singleQuote --no-style.semi
$ npm test
```

## Tests

`npm test`

## Features

- [x] `title` => `interface`
Expand All @@ -151,6 +178,7 @@ json2ts -i foo.json -o foo.d.ts --style.singleQuote --no-style.semi
- [x] Add support for running in browser
- [x] default interface name
- [x] infer unnamed interface name from filename
- [x] `deprecated`
- [x] `allOf` ("intersection")
- [x] `anyOf` ("union")
- [x] `oneOf` (treated like `anyOf`)
Expand Down Expand Up @@ -200,9 +228,14 @@ Prettier is known to run slowly on really big files. To skip formatting and impr

## Who uses JSON-Schema-to-TypeScript?

- [AWS](https://github.com/aws/aws-toolkit-vscode), [AWSLabs](https://github.com/awslabs/cdk8s)
- [Alibaba](https://github.com/alibaba/lowcode-engine)
- [Amazon](https://github.com/aws/aws-toolkit-vscode), [AWSLabs](https://github.com/awslabs/cdk8s)
- [Expo](https://github.com/expo/expo)
- [FormatJS](https://github.com/formatjs/formatjs)
- [Microsoft](https://github.com/microsoft/mixed-reality-extension-sdk)
- [Mozilla](https://github.com/mdn/browser-compat-data)
- [Nx](https://github.com/nrwl/nx)
- [RStudio](https://github.com/rstudio/rstudio)
- [Sourcegraph](https://github.com/sourcegraph/sourcegraph)
- [Stryker](https://github.com/stryker-mutator/stryker)
- [Webpack](https://github.com/webpack/webpack)
Expand Down
4 changes: 2 additions & 2 deletions example/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { writeFileSync } from 'fs'
import { compileFromFile } from 'json-schema-to-typescript'
import {writeFileSync} from 'fs'
import {compileFromFile} from 'json-schema-to-typescript'

async function generate() {
writeFileSync('person.d.ts', await compileFromFile('person.json'))
Expand Down
12 changes: 6 additions & 6 deletions example/person.d.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/* tslint:disable */
/* eslint-disable */
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/

export interface Person {
firstName: string;
lastName: string;
firstName: string
lastName: string
/**
* Age in years
*/
age?: number;
hairColor?: "black" | "brown" | "blue";
[k: string]: unknown;
age?: number
hairColor?: 'black' | 'brown' | 'blue'
[k: string]: unknown
}
Loading