|
5 | 5 | * Open API Parser |
6 | 6 | */ |
7 | 7 | component name="OpenAPIParser" accessors="true" { |
| 8 | + |
8 | 9 | //the base path of the APIDoc |
9 | 10 | property name="DocumentObject"; |
10 | 11 | property name="baseDocumentPath"; |
@@ -178,6 +179,7 @@ component name="OpenAPIParser" accessors="true" { |
178 | 179 | // If `DocItem` is an instance of Parser, we need to flattin it to a CFML struct |
179 | 180 | if ( |
180 | 181 | isStruct( DocItem ) && |
| 182 | + structKeyExists( getMetaData( DocItem ), "name" ) && |
181 | 183 | findNoCase( "Parser", getMetaData( DocItem ).name ) |
182 | 184 | ) { |
183 | 185 | DocItem = DocItem.getNormalizedDocument(); |
@@ -213,6 +215,7 @@ component name="OpenAPIParser" accessors="true" { |
213 | 215 | } else if( isStruct( DocItem[ key ] ) || isArray( DocItem[ key ] ) ){ |
214 | 216 | DocItem[ key ] = parseDocumentInheritance( parseDocumentReferences( DocItem[ key ] ) ); |
215 | 217 | } |
| 218 | + } |
216 | 219 |
|
217 | 220 | } |
218 | 221 |
|
@@ -302,23 +305,24 @@ component name="OpenAPIParser" accessors="true" { |
302 | 305 | var ReferenceDocument = {}; |
303 | 306 |
|
304 | 307 | try{ |
| 308 | + var basePath = isNull( getBaseDocumentPath() ) ? "/" : getDirectoryFromPath( getBaseDocumentPath() ); |
305 | 309 |
|
306 | 310 | //Files receive a parser reference |
307 | 311 | if( left( FilePath, 4 ) == 'http' ){ |
308 | 312 |
|
309 | 313 | ReferenceDocument = Wirebox.getInstance( "OpenAPIParser@SwaggerSDK" ).init( $ref ); |
310 | 314 |
|
311 | | - } else if( len( FilePath ) && fileExists( getDirectoryFromPath( getBaseDocumentPath() ) & FilePath )){ |
| 315 | + } else if( len( FilePath ) && fileExists( basePath & FilePath )){ |
312 | 316 |
|
313 | | - ReferenceDocument = Wirebox.getInstance( "OpenAPIParser@SwaggerSDK" ).init( getDirectoryFromPath( getBaseDocumentPath() ) & $ref ); |
| 317 | + ReferenceDocument = Wirebox.getInstance( "OpenAPIParser@SwaggerSDK" ).init( basePath & $ref ); |
314 | 318 |
|
315 | 319 | } else if( len( FilePath ) && fileExists( expandPath( FilePath ) ) ) { |
316 | 320 |
|
317 | | - ReferenceDocument = Wirebox.getInstance( "OpenAPIParser@SwaggerSDK" ).init( expandPath( FilePath ) & ( !isNull( xPath ) ? "##" & xPath : "" ) ); |
| 321 | + ReferenceDocument = Wirebox.getInstance( "OpenAPIParser@SwaggerSDK" ).init( expandPath( FilePath ) & ( !isNull( xPath ) ? "##" & xPath : "" ) ); |
318 | 322 |
|
319 | | - } else if( len( FilePath ) && !fileExists( getDirectoryFromPath( getBaseDocumentPath() ) & FilePath )) { |
| 323 | + } else if( len( FilePath ) && !fileExists( basePath & FilePath )) { |
320 | 324 |
|
321 | | - throw( type="SwaggerSDK.ParserException", message="File #( getDirectoryFromPath( getBaseDocumentPath() ) & FilePath )# does not exist" ); |
| 325 | + throw( type="SwaggerSDK.ParserException", message="File #( basePath & FilePath )# does not exist" ); |
322 | 326 |
|
323 | 327 | } else if( !isNull( XPath ) && len( XPath ) ) { |
324 | 328 |
|
|
0 commit comments