Skip to content

Commit 7c6bad4

Browse files
committed
add test case for #613
1 parent 402e188 commit 7c6bad4

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed

test/__snapshots__/test/test.ts.md

+20
Original file line numberDiff line numberDiff line change
@@ -448260,6 +448260,26 @@ Generated by [AVA](https://avajs.dev).
448260448260
}␊
448261448261
`
448262448262

448263+
## ref.7.js
448264+
448265+
> Expected output to match snapshot for e2e test: ref.7.js
448266+
448267+
`/* eslint-disable */␊
448268+
/**␊
448269+
* This file was automatically generated by json-schema-to-typescript.␊
448270+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,␊
448271+
* and run json-schema-to-typescript to regenerate this file.␊
448272+
*/␊
448273+
448274+
export interface Sample {␊
448275+
neighborhood?: Person[];␊
448276+
}␊
448277+
export interface Person {␊
448278+
age?: number;␊
448279+
[k: string]: unknown;␊
448280+
}␊
448281+
`
448282+
448263448283
## refWithCycle.1.js
448264448284

448265448285
> Expected output to match snapshot for e2e test: refWithCycle.1.js

test/__snapshots__/test/test.ts.snap

38 Bytes
Binary file not shown.

test/e2e/ref.7.ts

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// @see https://github.com/bcherny/json-schema-to-typescript/issues/613
2+
export const input = {
3+
$schema: 'https://json-schema.org/draft/2020-12/schema',
4+
title: 'Sample',
5+
type: 'object',
6+
additionalProperties: false,
7+
properties: {
8+
neighborhood: {
9+
type: 'array',
10+
items: {
11+
$ref: '#/$defs/person',
12+
},
13+
},
14+
},
15+
$defs: {
16+
baseType: {
17+
title: 'BaseType',
18+
type: 'object',
19+
properties: {
20+
name: {
21+
type: 'string',
22+
},
23+
},
24+
},
25+
person: {
26+
title: 'Person',
27+
$ref: '#/$defs/baseType',
28+
type: 'object',
29+
unevaluatedProperties: false,
30+
properties: {
31+
age: {
32+
type: 'number',
33+
},
34+
},
35+
},
36+
},
37+
}

0 commit comments

Comments
 (0)