Skip to content

Commit 3d81206

Browse files
committed
Upgrade dependencies. Add yarn
1 parent e2978e8 commit 3d81206

File tree

5 files changed

+783
-21
lines changed

5 files changed

+783
-21
lines changed

package.json

+12-12
Original file line numberDiff line numberDiff line change
@@ -38,27 +38,27 @@
3838
"schema"
3939
],
4040
"dependencies": {
41-
"glob": "~7.1.1",
41+
"glob": "~7.1.2",
4242
"json-stable-stringify": "^1.0.1",
4343
"typescript": "~2.1.5",
44-
"yargs": "^7.0.2"
44+
"yargs": "^8.0.1"
4545
},
4646
"devDependencies": {
4747
"@types/assertion-error": "^1.0.30",
48-
"@types/chai": "^3.4.35",
48+
"@types/chai": "^3.5.2",
4949
"@types/glob": "^5.0.30",
50-
"@types/json-stable-stringify": "^1.0.30",
51-
"@types/mocha": "^2.2.39",
52-
"@types/node": "^7.0.5",
53-
"ajv": "^4.11.3",
54-
"chai": "^3.5.0",
55-
"mocha": "^3.2.0",
56-
"source-map-support": "^0.4.11",
57-
"tslint": "^4.5.0"
50+
"@types/json-stable-stringify": "^1.0.31",
51+
"@types/mocha": "^2.2.41",
52+
"@types/node": "^7.0.22",
53+
"ajv": "^5.1.5",
54+
"chai": "^4.0.0",
55+
"mocha": "^3.4.2",
56+
"source-map-support": "^0.4.15",
57+
"tslint": "^5.3.2"
5858
},
5959
"scripts": {
6060
"test": "npm run build && mocha -t 5000 --require source-map-support/register test",
6161
"build": "tsc -p .",
62-
"lint": "tslint -c tslint.json 'typescript-json-schema.ts' 'test/**/*.ts' --exclude '**/*.d.ts'"
62+
"lint": "tslint --project tsconfig.json -c tslint.json --type-check --exclude '**/*.d.ts'"
6363
}
6464
}

test/schema.test.ts

+8-5
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,20 @@ import * as Ajv from "ajv";
77

88
const ajv = new Ajv();
99

10-
const base = "test/programs/";
10+
const metaSchema = require("ajv/lib/refs/json-schema-draft-04.json");
11+
ajv.addMetaSchema(metaSchema, "http://json-schema.org/draft-04/schema#");
12+
13+
const BASE = "test/programs/";
1114

1215
export function assertSchema(group: string, name: string, type: string, settings: TJS.PartialArgs = {}, compilerOptions?: CompilerOptions) {
1316
it(group + " should create correct schema", () => {
1417
if (!("generateRequired" in settings)) {
1518
settings.generateRequired = true;
1619
}
1720

18-
const actual = TJS.generateSchema(TJS.getProgramFromFiles([resolve(base + group + "/" + name)], compilerOptions), type, settings);
21+
const actual = TJS.generateSchema(TJS.getProgramFromFiles([resolve(BASE + group + "/" + name)], compilerOptions), type, settings);
1922

20-
const file = readFileSync(base + group + "/schema.json", "utf8");
23+
const file = readFileSync(BASE + group + "/schema.json", "utf8");
2124
const expected = JSON.parse(file);
2225

2326
assert.isObject(actual);
@@ -33,7 +36,7 @@ export function assertSchema(group: string, name: string, type: string, settings
3336

3437
describe("interfaces", () => {
3538
it("should return an instance of JsonSchemaGenerator", () => {
36-
const program = TJS.getProgramFromFiles([resolve(base + "comments/main.ts")]);
39+
const program = TJS.getProgramFromFiles([resolve(BASE + "comments/main.ts")]);
3740
const generator = TJS.buildGenerator(program);
3841

3942
assert.instanceOf(generator, TJS.JsonSchemaGenerator);
@@ -47,7 +50,7 @@ describe("interfaces", () => {
4750
}
4851
});
4952
it("should output the schemas set by setSchemaOverride", () => {
50-
const program = TJS.getProgramFromFiles([resolve(base + "interface-multi/main.ts")]);
53+
const program = TJS.getProgramFromFiles([resolve(BASE + "interface-multi/main.ts")]);
5154
const generator = TJS.buildGenerator(program);
5255
assert(generator !== null);
5356
if (generator !== null) {

tslint.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"no-switch-case-fall-through": true,
5151
"quotemark": [true, "double", "avoid-escape"],
5252
"triple-equals": [true, "allow-null-check"],
53-
"variable-name": [true, "check-format", "allow-leading-underscore", "ban-keywords"]
53+
"variable-name": [true, "check-format", "allow-leading-underscore", "ban-keywords"],
54+
"object-literal-key-quotes": [true, "as-needed"]
5455
}
5556
}

typescript-json-schema.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ export class JsonSchemaGenerator {
247247
definition.items = fixedTypes;
248248
definition.minItems = fixedTypes.length;
249249
definition.additionalItems = {
250-
"anyOf": fixedTypes
250+
anyOf: fixedTypes
251251
};
252252
} else {
253253
const propertyTypeString = tc.typeToString(propertyType, undefined, ts.TypeFormatFlags.UseFullyQualifiedType);
@@ -676,7 +676,7 @@ export class JsonSchemaGenerator {
676676

677677
if (asRef) {
678678
returnedDefinition = {
679-
"$ref": "#/definitions/" + fullTypeName
679+
$ref: "#/definitions/" + fullTypeName
680680
};
681681
}
682682

@@ -760,7 +760,7 @@ export class JsonSchemaGenerator {
760760

761761
public getSchemaForSymbols(symbols: string[]): Definition {
762762
const root = {
763-
"$schema": "http://json-schema.org/draft-04/schema#",
763+
$schema: "http://json-schema.org/draft-04/schema#",
764764
definitions: {}
765765
};
766766
for (let i = 0; i < symbols.length; i++) {

0 commit comments

Comments
 (0)