@asyncapi/cli 0.56.3 → 0.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -7,7 +7,7 @@ export declare class SpecificationFileNotFound extends SpecificationFileError {
|
|
|
7
7
|
export declare class SpecificationURLNotFound extends SpecificationFileError {
|
|
8
8
|
constructor(URL: string);
|
|
9
9
|
}
|
|
10
|
-
declare type From = 'file' | 'url' | 'context';
|
|
10
|
+
declare type From = 'file' | 'url' | 'context' | 'invalid file';
|
|
11
11
|
export declare class ErrorLoadingSpec extends Error {
|
|
12
12
|
private readonly errorMessages;
|
|
13
13
|
constructor(from?: From, param?: string);
|
|
@@ -45,6 +45,10 @@ class ErrorLoadingSpec extends Error {
|
|
|
45
45
|
this.name = 'error loading AsyncAPI document from context';
|
|
46
46
|
this.message = `${param} context name does not exist.`;
|
|
47
47
|
}
|
|
48
|
+
if (from === 'invalid file') {
|
|
49
|
+
this.name = 'Invalid AsyncAPI file type';
|
|
50
|
+
this.message = 'cli only supports yml ,yaml ,json extension';
|
|
51
|
+
}
|
|
48
52
|
if (!from) {
|
|
49
53
|
this.name = 'error locating AsyncAPI document';
|
|
50
54
|
this.message = this.errorMessages.default;
|
|
@@ -184,6 +184,11 @@ function fileExists(name) {
|
|
|
184
184
|
if ((yield lstat(name)).isFile()) {
|
|
185
185
|
return true;
|
|
186
186
|
}
|
|
187
|
+
const extension = name.split('.')[1];
|
|
188
|
+
const allowedExtenstion = ['yml', 'yaml', 'json'];
|
|
189
|
+
if (!allowedExtenstion.includes(extension)) {
|
|
190
|
+
throw new specification_file_1.ErrorLoadingSpec('invalid file', name);
|
|
191
|
+
}
|
|
187
192
|
throw new specification_file_1.ErrorLoadingSpec('file', name);
|
|
188
193
|
}
|
|
189
194
|
catch (e) {
|
package/oclif.manifest.json
CHANGED