File tree Expand file tree Collapse file tree 4 files changed +8
-8
lines changed Expand file tree Collapse file tree 4 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 1
1
< div class ="api-info-wrapper ">
2
2
< h1 > {{info.title}} < span class ="api-info-version "> ({{info.version}})</ span > </ h1 >
3
- < p >
3
+ < p class =" donwload-openapi " *ngIf =" specUrl " >
4
4
Download OpenAPI (fka Swagger) specification:
5
5
< a class ="openapi-button " target ="_blank " attr.href ='{{specUrl}} '> Download </ a >
6
6
</ p >
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ export class ApiInfo extends BaseComponent implements OnInit {
23
23
24
24
init ( ) {
25
25
this . info = this . componentSchema . info ;
26
- this . specUrl = this . optionsService . options . specUrl ;
26
+ this . specUrl = this . specMgr . specUrl ;
27
27
if ( ! isNaN ( parseInt ( this . info . version . toString ( ) . substring ( 0 , 1 ) ) ) ) {
28
28
this . info . version = 'v' + this . info . version ;
29
29
}
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ export class SpecManager {
32
32
public basePath : string ;
33
33
34
34
public spec = new BehaviorSubject < any | null > ( null ) ;
35
- public _specUrl : string ;
35
+ public specUrl : string ;
36
36
private parser : any ;
37
37
private options : Options ;
38
38
@@ -46,7 +46,7 @@ export class SpecManager {
46
46
this . parser . bundle ( urlOrObject , { http : { withCredentials : false } } )
47
47
. then ( schema => {
48
48
if ( typeof urlOrObject === 'string' ) {
49
- this . _specUrl = urlOrObject ;
49
+ this . specUrl = urlOrObject ;
50
50
}
51
51
this . _schema = snapshot ( schema ) ;
52
52
try {
@@ -64,7 +64,7 @@ export class SpecManager {
64
64
65
65
/* calculate common used values */
66
66
init ( ) {
67
- let urlParts = this . _specUrl ? urlParse ( urlResolve ( window . location . href , this . _specUrl ) ) : { } ;
67
+ let urlParts = this . specUrl ? urlParse ( urlResolve ( window . location . href , this . specUrl ) ) : { } ;
68
68
let schemes = this . _schema . schemes ;
69
69
let protocol ;
70
70
if ( ! schemes || ! schemes . length ) {
Original file line number Diff line number Diff line change @@ -46,21 +46,21 @@ describe('Utils', () => {
46
46
47
47
it ( 'should substitute api scheme when spec schemes are undefined' , ( ) => {
48
48
specMgr . _schema . schemes = undefined ;
49
- specMgr . _specUrl = 'https://petstore.swagger.io/v2' ;
49
+ specMgr . specUrl = 'https://petstore.swagger.io/v2' ;
50
50
specMgr . init ( ) ;
51
51
specMgr . apiUrl . should . be . equal ( 'https://petstore.swagger.io/v2' ) ;
52
52
} ) ;
53
53
54
54
it ( 'should substitute api host when spec host is undefined' , ( ) => {
55
55
specMgr . _schema . host = undefined ;
56
- specMgr . _specUrl = 'http://petstore.swagger.io/v2' ;
56
+ specMgr . specUrl = 'http://petstore.swagger.io/v2' ;
57
57
specMgr . init ( ) ;
58
58
specMgr . apiUrl . should . be . equal ( 'http://petstore.swagger.io/v2' ) ;
59
59
} ) ;
60
60
61
61
it ( 'should use empty basePath when basePath is not present' , ( ) => {
62
62
specMgr . _schema . basePath = undefined ;
63
- specMgr . _specUrl = 'https://petstore.swagger.io' ;
63
+ specMgr . specUrl = 'https://petstore.swagger.io' ;
64
64
specMgr . init ( ) ;
65
65
specMgr . basePath . should . be . equal ( '' ) ;
66
66
} ) ;
You can’t perform that action at this time.
0 commit comments