Skip to content

Commit bfdb476

Browse files
author
nickpape-msft
authored
Merge pull request microsoft#94 from Microsoft/nickpape/update-validator-issue
Make the thing that exposes z-schema private to avoid the weird typings error
2 parents e0a5502 + 0b23ace commit bfdb476

7 files changed

Lines changed: 21 additions & 16 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@microsoft/gulp-core-build",
5+
"comment": "Remove a function which was exposing z-schema and causing issues.",
6+
"type": "minor"
7+
}
8+
],
9+
"email": "nickpape@users.noreply.github.com"
10+
}

common/reviews/api/gulp-core-build.api.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,6 @@ export function replaceConfig(config: IBuildConfig): void;
131131
export function reset(): void;
132132

133133
class SchemaValidator {
134-
// (undocumented)
135-
public static getFormattedErrorMessage(errors: Validator.SchemaErrorDetail[], dataFilePath?: string): string;
136134
public static readAndValidateJson < TResult >(dataFilePath: string, schemaFilePath: string): TResult;
137135
// (undocumented)
138136
public static readCommentedJsonFile < TResult >(filename: string): TResult;

common/reviews/api/node-library-build.api.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,6 @@ export declare function replaceConfig(config: IBuildConfig): void;
146146
export declare function reset(): void;
147147

148148
class SchemaValidator {
149-
// (undocumented)
150-
static getFormattedErrorMessage(errors: Validator.SchemaErrorDetail[], dataFilePath?: string): string;
151149
static readAndValidateJson < TResult >(dataFilePath: string, schemaFilePath: string): TResult;
152150
// (undocumented)
153151
static readCommentedJsonFile < TResult >(filename: string): TResult;

common/reviews/api/web-library-build.api.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,6 @@ export declare function replaceConfig(config: IBuildConfig): void;
154154
export declare function reset(): void;
155155

156156
class SchemaValidator {
157-
// (undocumented)
158-
static getFormattedErrorMessage(errors: Validator.SchemaErrorDetail[], dataFilePath?: string): string;
159157
static readAndValidateJson < TResult >(dataFilePath: string, schemaFilePath: string): TResult;
160158
// (undocumented)
161159
static readCommentedJsonFile < TResult >(filename: string): TResult;

gulp-core-build/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
"@types/through2": "^2.0.31",
3131
"@types/vinyl": "^1.2.30",
3232
"@types/yargs": "0.0.34",
33-
"@types/z-schema": "~3.16.31",
3433
"del": "^2.2.2",
3534
"end-of-stream": "~1.1.0",
3635
"es6-promise": "~3.1.2",
@@ -53,6 +52,7 @@
5352
"z-schema": "~3.17.0"
5453
},
5554
"devDependencies": {
55+
"@types/z-schema": "~3.16.31",
5656
"@microsoft/node-library-build": ">=2.2.0 <3.0.0",
5757
"chai": "~3.5.0",
5858
"typescript": "~2.1.4"

gulp-core-build/src/jsonUtilities/SchemaValidator.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,6 @@ export class SchemaValidator {
4444
return undefined;
4545
}
4646

47-
public static getFormattedErrorMessage(errors: Validator.SchemaErrorDetail[], dataFilePath?: string): string {
48-
const errorMessage: string =
49-
(dataFilePath ? `Error parsing file '${path.basename(dataFilePath)}'${os.EOL}` : '') +
50-
this._extractInnerErrorMessages(errors).join(os.EOL);
51-
52-
return os.EOL + 'ERROR: ' + errorMessage + os.EOL + os.EOL;
53-
}
54-
5547
public static readCommentedJsonFile<TResult>(filename: string): TResult {
5648
const contents: Buffer = fs.readFileSync(filename);
5749
let rawConfig: Object;
@@ -66,6 +58,14 @@ export class SchemaValidator {
6658
return rawConfig as TResult;
6759
}
6860

61+
private static getFormattedErrorMessage(errors: Validator.SchemaErrorDetail[], dataFilePath?: string): string {
62+
const errorMessage: string =
63+
(dataFilePath ? `Error parsing file '${path.basename(dataFilePath)}'${os.EOL}` : '') +
64+
this._extractInnerErrorMessages(errors).join(os.EOL);
65+
66+
return os.EOL + 'ERROR: ' + errorMessage + os.EOL + os.EOL;
67+
}
68+
6969
private static _extractInnerErrorMessages(errors: Validator.SchemaErrorDetail[]): string[] {
7070
const errorList: string[] = [];
7171
errors.map((error) => { errorList.push(...this._formatZSchemaError(error)); });

gulp-core-build/src/jsonUtilities/test/SchemaValidator.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ describe('SchemaValidator', () => {
6161
]
6262
};
6363
assert.equal(
64-
SchemaValidator.getFormattedErrorMessage(error.details),
64+
// tslint:disable-next-line:no-any
65+
(SchemaValidator as any).getFormattedErrorMessage(error.details),
6566
['',
6667
'ERROR: (#/) Missing required property: bar',
6768
'',

0 commit comments

Comments
 (0)