Skip to content

Commit f35cb57

Browse files
committed
Fixes for Lucee 6
1 parent 22bb32b commit f35cb57

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

models/OpenAPI/Parser.cfc

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Open API Parser
66
*/
77
component name="OpenAPIParser" accessors="true" {
8+
89
//the base path of the APIDoc
910
property name="DocumentObject";
1011
property name="baseDocumentPath";
@@ -178,6 +179,7 @@ component name="OpenAPIParser" accessors="true" {
178179
// If `DocItem` is an instance of Parser, we need to flattin it to a CFML struct
179180
if (
180181
isStruct( DocItem ) &&
182+
structKeyExists( getMetaData( DocItem ), "name" ) &&
181183
findNoCase( "Parser", getMetaData( DocItem ).name )
182184
) {
183185
DocItem = DocItem.getNormalizedDocument();
@@ -213,6 +215,7 @@ component name="OpenAPIParser" accessors="true" {
213215
} else if( isStruct( DocItem[ key ] ) || isArray( DocItem[ key ] ) ){
214216
DocItem[ key ] = parseDocumentInheritance( parseDocumentReferences( DocItem[ key ] ) );
215217
}
218+
}
216219

217220
}
218221

@@ -302,23 +305,24 @@ component name="OpenAPIParser" accessors="true" {
302305
var ReferenceDocument = {};
303306

304307
try{
308+
var basePath = isNull( getBaseDocumentPath() ) ? "/" : getDirectoryFromPath( getBaseDocumentPath() );
305309

306310
//Files receive a parser reference
307311
if( left( FilePath, 4 ) == 'http' ){
308312

309313
ReferenceDocument = Wirebox.getInstance( "OpenAPIParser@SwaggerSDK" ).init( $ref );
310314

311-
} else if( len( FilePath ) && fileExists( getDirectoryFromPath( getBaseDocumentPath() ) & FilePath )){
315+
} else if( len( FilePath ) && fileExists( basePath & FilePath )){
312316

313-
ReferenceDocument = Wirebox.getInstance( "OpenAPIParser@SwaggerSDK" ).init( getDirectoryFromPath( getBaseDocumentPath() ) & $ref );
317+
ReferenceDocument = Wirebox.getInstance( "OpenAPIParser@SwaggerSDK" ).init( basePath & $ref );
314318

315319
} else if( len( FilePath ) && fileExists( expandPath( FilePath ) ) ) {
316320

317-
ReferenceDocument = Wirebox.getInstance( "OpenAPIParser@SwaggerSDK" ).init( expandPath( FilePath ) & ( !isNull( xPath ) ? "##" & xPath : "" ) );
321+
ReferenceDocument = Wirebox.getInstance( "OpenAPIParser@SwaggerSDK" ).init( expandPath( FilePath ) & ( !isNull( xPath ) ? "##" & xPath : "" ) );
318322

319-
} else if( len( FilePath ) && !fileExists( getDirectoryFromPath( getBaseDocumentPath() ) & FilePath )) {
323+
} else if( len( FilePath ) && !fileExists( basePath & FilePath )) {
320324

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" );
322326

323327
} else if( !isNull( XPath ) && len( XPath ) ) {
324328

0 commit comments

Comments
 (0)