This repository was archived by the owner on Nov 8, 2024. It is now read-only.
File tree 2 files changed +12
-1
lines changed
2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ function parse(source, context) {
144
144
R . prop ( 'content' ) ,
145
145
R . find ( R . both ( isMember , hasKey ( 'openapi' ) ) ) ,
146
146
R . path ( [ 'content' , 'value' ] ) ,
147
- R . and ( isString , R . prop ( 'content' ) )
147
+ R . ifElse ( isString , R . prop ( 'content' ) , R . always ( '3.0.3 ') )
148
148
) , R . always ( '3.0.3' )
149
149
) ( document ) ;
150
150
Original file line number Diff line number Diff line change @@ -62,4 +62,15 @@ describe('#parse', () => {
62
62
expect ( link . title . toValue ( ) ) . to . equal ( 'OpenAPI 3.0.3' ) ;
63
63
expect ( link . href . toValue ( ) ) . to . equal ( 'https://spec.openapis.org/oas/v3.0.3' ) ;
64
64
} ) ;
65
+
66
+ it ( 'add OpenAPI 3.0.3 format link when OpenAPI property is not a string' , ( ) => {
67
+ const source = 'openapi: {"test": "3.0.0"}\ninfo: {title: My API, version: 1.0.0}\npaths: {}\n' ;
68
+ const parseResult = parse ( source , context ) ;
69
+
70
+ const link = parseResult . links . get ( 0 ) ;
71
+ expect ( link ) . to . be . instanceof ( Link ) ;
72
+ expect ( link . relation . toValue ( ) ) . to . equal ( 'via' ) ;
73
+ expect ( link . title . toValue ( ) ) . to . equal ( 'OpenAPI 3.0.3' ) ;
74
+ expect ( link . href . toValue ( ) ) . to . equal ( 'https://spec.openapis.org/oas/v3.0.3' ) ;
75
+ } ) ;
65
76
} ) ;
You can’t perform that action at this time.
0 commit comments