forked from YousefED/typescript-json-schema
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
YousefED
committed
Oct 2, 2015
1 parent
ad14f1c
commit 8a5071e
Showing
8 changed files
with
100 additions
and
26 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,38 @@ | ||
/// <reference path="../misc/dimension.ts"/> | ||
/// <reference path="../product.ts"/> | ||
|
||
/** | ||
* Represents the document sent to the customer for payment. | ||
*/ | ||
interface Invoice { | ||
/** | ||
* Who will pay? | ||
* Not me! | ||
*/ | ||
customer: string; | ||
|
||
/** | ||
* Invoice content | ||
* @minItems 1 | ||
* @maxItems 50 | ||
*/ | ||
lines: InvoiceLine[]; | ||
|
||
dimension: Dimension; // Total dimension of the order | ||
|
||
blob: any; // Additional stuff | ||
} | ||
|
||
interface InvoiceLine { | ||
|
||
product: Product; | ||
|
||
/** | ||
* @minimum 0 | ||
* @exclusiveMinimum true | ||
* @maximum 10 | ||
* @exclusiveMaximum false | ||
* @multipleOf 2 | ||
*/ | ||
quantity: number; | ||
} |
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,11 @@ | ||
// Typescript-JSON-Schema can handle defaults in classes as illustrated below | ||
class Dimension { | ||
/** Width in cm */ | ||
width: number = 10; | ||
|
||
/** Height in cm */ | ||
height: number = 10; | ||
|
||
/** Length in cm */ | ||
length: number = 10; | ||
} |
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,28 @@ | ||
/// <reference path="misc/dimension.ts"/> | ||
|
||
interface Product { | ||
/** | ||
* Uniquely defines the product | ||
* @pattern [A-Z][a-z][0-9]_ | ||
*/ | ||
name: string; | ||
|
||
/** How big it is */ | ||
dimension?: Dimension; | ||
|
||
/** Classification */ | ||
category: Category; | ||
} | ||
|
||
interface WeightedProduct extends Product { | ||
weight: number; | ||
} | ||
|
||
interface Category { | ||
/** Uniquely identifies the category */ | ||
name: string; | ||
|
||
/** Classification level from 1 to 5 (highest) | ||
* @type integer */ | ||
level: number; | ||
} |
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