Skip to content

Commit accd016

Browse files
committed
fix: do not crash if version is not string
closes #208
1 parent 9d0dd25 commit accd016

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/components/ApiInfo/api-info.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class ApiInfo extends BaseComponent implements OnInit {
2424
init() {
2525
this.info = this.componentSchema.info;
2626
this.specUrl = this.optionsService.options.specUrl;
27-
if (!isNaN(parseInt(this.info.version.substring(0, 1)))) {
27+
if (!isNaN(parseInt(this.info.version.toString().substring(0, 1)))) {
2828
this.info.version = 'v' + this.info.version;
2929
}
3030
}

lib/utils/spec-manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export class SpecManager {
8383
preprocess() {
8484
let mdRender = new MdRenderer();
8585
if (!this._schema.info) {
86-
throw 'Required field "info" is not specified at the spec top level';
86+
throw Error('Specification Error: Required field "info" is not specified at the top level of the specification');
8787
}
8888
if (!this._schema.info.description) this._schema.info.description = '';
8989
if (this._schema.securityDefinitions) {

0 commit comments

Comments
 (0)