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

upgrade version #1

Open
wants to merge 44 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
d791ca8
Fix recursive intersecting types bug with noExtraProps, probably fixe…
mambla Mar 6, 2023
34f427a
Update typescript to 4.9.5 (#529)
netanel-mce Mar 22, 2023
4642f6d
v0.56.0
domoritz Apr 2, 2023
fca5cef
docs: fix links
domoritz Apr 2, 2023
2df0bea
Support indexed access (#532)
netanel-mce Apr 3, 2023
d9484e8
use const instead of enum (#535)
lublak Apr 27, 2023
d2124fd
fix: include Title in referenced definitions (#541)
FreaKnightKurtosys May 15, 2023
ea75736
Update path-equal so users don't need to install tslib (#543)
rmehner May 23, 2023
6818b13
Fix yarn.lock (#544)
rmehner May 24, 2023
e483c33
Update Api Docs with newest version created by `yarn docs` (#545)
rmehner May 24, 2023
3f776fc
Compatibility to draft 07 (#537)
netanel-mce Jun 5, 2023
f480386
ci: update actions (#531)
domoritz Jun 5, 2023
b3ea0a0
v0.57.0
domoritz Jun 5, 2023
94293e7
Remove check for !forceNotRef (#549)
olofd Jun 8, 2023
9e7804a
Single union case shouldn't overwrite existing properties (#550)
jwatzman Jun 9, 2023
b114570
Overcame typescript bug in property start with multi underscores (#552)
netanel-mce Jun 20, 2023
82eedec
v0.58.0
domoritz Jun 25, 2023
8d65bb2
v0.58.1
domoritz Jun 25, 2023
17ee848
Fix type enum (without revert) (#557)
jwatzman Jul 12, 2023
f1b92c9
Update api docs
domoritz Jul 14, 2023
e9ef7a5
v0.59.0
domoritz Jul 14, 2023
f4600cf
Update to typescript 5.1 (#564)
sukovanej Aug 13, 2023
3662786
turn on "noExtraProps" flag in auto test (#563)
netanel-mce Aug 20, 2023
f38327e
Correct schema for mapped object with other keys (#567)
netanel-mce Aug 24, 2023
4ee4b09
v0.60.0
domoritz Aug 24, 2023
3268f3b
fix #426 (#569)
chatcan Sep 1, 2023
a9bb215
add constAsEnum flag to convert constant values to single value enum …
gassiss Sep 7, 2023
655d774
v0.61.0
domoritz Sep 7, 2023
c55b419
Remove enum sorting (#576)
Elliot-Ball-Tray Oct 4, 2023
ec3f098
v0.62.0
domoritz Oct 13, 2023
0a963ca
fix: avoid unrelated schemaOverrides when building definition for sin…
lundibundi Feb 14, 2024
010adce
fix: return overrides schema in getSchemaForSymbol (#590)
lundibundi Feb 15, 2024
2bfec01
v0.63.0
domoritz Feb 15, 2024
264ab45
Remove suppressImplicitAnyIndexErrors. (#593)
raineorshine Mar 15, 2024
3426762
feat: support bigint (#596)
bradleypriest Apr 5, 2024
54a651c
fix: escape special characters in string template literals (#603)
ahochsteger May 14, 2024
1bbf4a9
feat: $comment keyword (#604)
andriskaaz May 30, 2024
acc0c45
Add support for experimentalDecorators ts option. To use with TS5 dec…
krizka Jun 6, 2024
b9683f6
v0.64.0
domoritz Jun 12, 2024
70de093
deps: update typescript version (#610)
ivan-tymoshenko Aug 5, 2024
3a3718b
v0.65.0
domoritz Aug 20, 2024
2422f97
v0.65.1
domoritz Aug 20, 2024
75e599a
feat: include tuple names in json schema (#613)
k-yle Sep 19, 2024
43e557d
chore: note about maintenance mode and suggested other options
domoritz Nov 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- run: yarn --frozen-lockfile
- name: Lint
run: yarn lint
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![npm version](https://img.shields.io/npm/v/typescript-json-schema.svg)](https://www.npmjs.com/package/typescript-json-schema) ![Test](https://github.com/YousefED/typescript-json-schema/workflows/Test/badge.svg)

Generate json-schemas from your Typescript sources.
Generate json-schemas from your Typescript sources. This library is lightweight and more or less in maintenance mode. For a more complete JSON schema generator, take a look at [ts-json-schema-generator](https://github.com/vega/ts-json-schema-generator).

## Features

Expand Down Expand Up @@ -51,6 +51,9 @@ Options:
--id Set schema id. [string] [default: ""]
--defaultNumberType Default number type. [choices: "number", "integer"] [default: "number"]
--tsNodeRegister Use ts-node/register (needed for require typescript files). [boolean] [default: false]
--constAsEnum Use enums with a single value when declaring constants. [boolean] [default: false]
--experimentalDecorators Use experimentalDecorators when loading typescript modules.
[boolean] [default: true]
```

### Programmatic use
Expand Down
261 changes: 259 additions & 2 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,20 @@ interface MySubObject {
a: boolean;
}

interface AnotherSubObject {
b: boolean;
}

interface MyObject {
/**
* @title empty#
*/
empty;

/**
* @title filled
*/
filled: MySubObject;
nonTitled: AnotherSubObject;
}
```

Expand Down Expand Up @@ -485,6 +492,21 @@ interface MyObject {
```


## [comments-comment](./test/programs/comments-comment)

```ts
/**
* @$comment Object comment
*/
interface MyObject {
/**
* @$comment Property comment
*/
text: string;
}
```


## [comments-from-lib](./test/programs/comments-from-lib)

```ts
Expand Down Expand Up @@ -600,6 +622,25 @@ export interface MyObject {
```


## [const-as-enum](./test/programs/const-as-enum)

```ts
export interface MyObject {
reference: true;
}
```


## [const-keyword](./test/programs/const-keyword)

```ts
const fn = <const T>(value: T) =>
({ value });

export type Object = ReturnType<typeof fn<"value">>;
```


## [custom-dates](./test/programs/custom-dates)

```ts
Expand Down Expand Up @@ -1032,6 +1073,68 @@ export interface MyObject {
```


## [key-in-key-of-multi](./test/programs/key-in-key-of-multi)

```ts
type Util = {
utilKey1: {
utilDeepKey11: string;
utilDeepKey12: number;
};
utilKey2: {
utilDeepKey21: boolean;
utilDeepKey22: null;
};
};

export type Main = {
[Key in keyof Util]: {
[key: string]: Util[Key];
};
};
```


## [key-in-key-of-multi-underscores](./test/programs/key-in-key-of-multi-underscores)

```ts
type Util = {
__2Underscores: {
utilDeepKey2: string;
};
___3Underscores: {
utilDeepKey3: string;
};
____4Underscores: {
utilDeepKey4: string;
};
};

export type Main = {
[Key in keyof Util]: {
[key: string]: Util[Key];
};
};
```


## [key-in-key-of-single](./test/programs/key-in-key-of-single)

```ts
type Util = {
utilKey: {
utilDeepKey: string;
};
};

export type Main = {
[Key in keyof Util]: {
[key: string]: Util[Key];
};
};
```


## [map-types](./test/programs/map-types)

```ts
Expand Down Expand Up @@ -1170,6 +1273,21 @@ export interface Never {
```


## [no-ref](./test/programs/no-ref)

```ts
type MySubType = {
id: string;
};

export type MyModule = {
address: MySubType & { extraProp: number };
address2: MySubType;
address3: MySubType;
};
```


## [no-unrelated-definitions](./test/programs/no-unrelated-definitions)

```ts
Expand All @@ -1191,6 +1309,17 @@ interface SomeOtherDefinition {
```


## [numeric-keys-and-others](./test/programs/numeric-keys-and-others)

```ts
interface NumericKeysAndOthers {
[key: number]: number;
a: string;
b: boolean;
}
```


## [object-numeric-index](./test/programs/object-numeric-index)

```ts
Expand Down Expand Up @@ -1280,6 +1409,26 @@ export class ObjectId {}
```


## [satisfies-keyword](./test/programs/satisfies-keyword)

```ts
interface Basic {
a: string;
b: number;
c: boolean;
}

const myObject = {
a: "a" as const,
b: 1 as const,
c: true as const,
// tslint:disable-next-line:variable-name
} satisfies Basic;

export type Specific = typeof myObject;
```


## [strict-null-checks](./test/programs/strict-null-checks)

```ts
Expand Down Expand Up @@ -1320,6 +1469,33 @@ class MyObject {
```


## [string-template-literal](./test/programs/string-template-literal)

```ts
interface MyObject {
a: `@${string}`,
b: `@${number}`,
c: `@${bigint}`,
d: `@${boolean}`,
e: `@${undefined}`,
f: `@${null}`,
g: `${string}@`,
h: `${number}@`,
i: `${string}@${number}`,
j: `${string}.${string}`,
}
```


## [symbol](./test/programs/symbol)

```ts
export type MyObject = {
a: symbol;
};
```


## [tsconfig](./test/programs/tsconfig)

```ts
Expand Down Expand Up @@ -1353,6 +1529,13 @@ export interface IncludedOnlyByTsConfig {
```


## [type-alias-never](./test/programs/type-alias-never)

```ts
export type MyNever = never;
```


## [type-alias-or](./test/programs/type-alias-or)

```ts
Expand Down Expand Up @@ -1400,6 +1583,13 @@ type MyString = string;
```


## [type-alias-undefined](./test/programs/type-alias-undefined)

```ts
export type MyUndefined = undefined;
```


## [type-aliases](./test/programs/type-aliases)

```ts
Expand Down Expand Up @@ -1764,8 +1954,37 @@ interface ChildFoo {
}

interface Foo {
readonly childFoos: Foo & ChildFoo;
readonly childFoos: Foo | ChildFoo;
}
```


## [type-intersection-recursive-no-additional](./test/programs/type-intersection-recursive-no-additional)

```ts
type MyRecursiveNode = {
next?: MyNode;
}

type MyNode = {
val: string;
} & MyRecursiveNode;

type MyLinkedList = MyNode;
```


## [type-literals](./test/programs/type-literals)

```ts
type MyObject = {
param1: "1" | "2" | "3";
param2: "1" | "2" | 3 | true;
/** @enum {string} */
param3: "1" | "2" | "3";
/** @enum {unknown} */
param4: "1" | "2" | 3 | true;
};
```


Expand Down Expand Up @@ -1894,6 +2113,34 @@ interface MyObject {
```


## [type-union-strict-null-keep-description](./test/programs/type-union-strict-null-keep-description)

```ts
/**
* Description of InnerObject.
*/
type InnerObject = {
/**
* Description of foo.
*/
foo: string;
};

/**
* Description of MyObject.
*/
type MyObject = {

inner1?: InnerObject;

/**
* Override description.
*/
inner2?: InnerObject;
};
```


## [type-union-tagged](./test/programs/type-union-tagged)

```ts
Expand Down Expand Up @@ -1927,6 +2174,16 @@ interface MyObject {
```


## [undefined-property](./test/programs/undefined-property)

```ts
export type MyObject = {
a: string;
b: undefined;
};
```


## [unique-names](./test/programs/unique-names)

```ts
Expand Down
Loading