-
Notifications
You must be signed in to change notification settings - Fork 376
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #111 from alesandroLang/extends
added support for the "extends" keyword
- Loading branch information
Showing
8 changed files
with
190 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
export const input = { | ||
"title": "Extends", | ||
'type': "object", | ||
"extends": { | ||
"$ref": "test/resources/BaseType.1.json" | ||
}, | ||
properties: { | ||
"foo": { | ||
"type": "string" | ||
} | ||
}, | ||
required: ["foo"], | ||
additionalProperties: false | ||
} | ||
|
||
export const outputs = [ | ||
{ | ||
options: { | ||
declareExternallyReferenced: true | ||
}, | ||
output: `/** | ||
* 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 Extends extends Base1 { | ||
foo: string; | ||
} | ||
export interface Base1 { | ||
firstName: string; | ||
lastName: string; | ||
} | ||
` | ||
}, | ||
{ | ||
options: { | ||
declareExternallyReferenced: false | ||
}, | ||
output: `/** | ||
* 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 Extends extends Base1 { | ||
foo: string; | ||
} | ||
` | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
export const input = { | ||
"title": "Extends", | ||
'type': "object", | ||
"extends": [ | ||
{ | ||
"$ref": "test/resources/BaseType.1.json" | ||
}, | ||
{ | ||
"$ref": "test/resources/BaseType.2.json" | ||
} | ||
], | ||
properties: { | ||
"foo": { | ||
"type": "string" | ||
} | ||
}, | ||
required: ["foo"], | ||
additionalProperties: false | ||
} | ||
|
||
export const outputs = [ | ||
{ | ||
options: { | ||
declareExternallyReferenced: true | ||
}, | ||
output: `/** | ||
* 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 Extends extends Base1, Base2 { | ||
foo: string; | ||
} | ||
export interface Base1 { | ||
firstName: string; | ||
lastName: string; | ||
} | ||
export interface Base2 { | ||
age: number; | ||
} | ||
` | ||
}, | ||
{ | ||
options: { | ||
declareExternallyReferenced: false | ||
}, | ||
output: `/** | ||
* 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 Extends extends Base1, Base2 { | ||
foo: string; | ||
} | ||
` | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"id": "http://dummy.com/api/base1", | ||
"title": "Base1", | ||
"type": "object", | ||
"properties": { | ||
"firstName": { | ||
"type": "string" | ||
}, | ||
"lastName": { | ||
"type": "string" | ||
} | ||
}, | ||
"required": ["firstName", "lastName"], | ||
"additionalProperties": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"id": "http://dummy.com/api/base2", | ||
"title": "Base2", | ||
"type": "object", | ||
"properties": { | ||
"age": { | ||
"type": "integer" | ||
} | ||
}, | ||
"required": ["age"], | ||
"additionalProperties": false | ||
} |