prepend v to api version

This commit is contained in:
Roman Hotsiy 2016-07-01 18:09:42 +03:00
parent 2d54a67c2c
commit 6a8f1e6e21
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
2 changed files with 4 additions and 1 deletions

View File

@ -39,7 +39,7 @@ describe('Redoc components', () => {
it('should render api name and version', () => { it('should render api name and version', () => {
let nativeElement = getChildDebugElement(fixture.debugElement, 'api-info').nativeElement; let nativeElement = getChildDebugElement(fixture.debugElement, 'api-info').nativeElement;
let headerElement = nativeElement.querySelector('h1'); let headerElement = nativeElement.querySelector('h1');
expect(headerElement.innerText).toContain('Swagger Petstore (1.0.0)'); expect(headerElement.innerText).toContain('Swagger Petstore (v1.0.0)');
}); });
}); });
}); });

View File

@ -18,5 +18,8 @@ export class ApiInfo extends BaseComponent {
prepareModel() { prepareModel() {
this.data = this.componentSchema.info; this.data = this.componentSchema.info;
this.specUrl = this.optionsService.options.specUrl; this.specUrl = this.optionsService.options.specUrl;
if (parseInt(this.data.version.substring(0, 1)) !== NaN) {
this.data.version = 'v' + this.data.version;
}
} }
} }