Skip to content

Commit

Permalink
Fixes for Lucee 6
Browse files Browse the repository at this point in the history
  • Loading branch information
elpete committed Feb 13, 2025
1 parent 22bb32b commit f35cb57
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions models/OpenAPI/Parser.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Open API Parser
*/
component name="OpenAPIParser" accessors="true" {

//the base path of the APIDoc
property name="DocumentObject";
property name="baseDocumentPath";
Expand Down Expand Up @@ -178,6 +179,7 @@ component name="OpenAPIParser" accessors="true" {
// If `DocItem` is an instance of Parser, we need to flattin it to a CFML struct
if (
isStruct( DocItem ) &&
structKeyExists( getMetaData( DocItem ), "name" ) &&
findNoCase( "Parser", getMetaData( DocItem ).name )
) {
DocItem = DocItem.getNormalizedDocument();
Expand Down Expand Up @@ -213,6 +215,7 @@ component name="OpenAPIParser" accessors="true" {
} else if( isStruct( DocItem[ key ] ) || isArray( DocItem[ key ] ) ){
DocItem[ key ] = parseDocumentInheritance( parseDocumentReferences( DocItem[ key ] ) );
}
}

}

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

try{
var basePath = isNull( getBaseDocumentPath() ) ? "/" : getDirectoryFromPath( getBaseDocumentPath() );

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

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

} else if( len( FilePath ) && fileExists( getDirectoryFromPath( getBaseDocumentPath() ) & FilePath )){
} else if( len( FilePath ) && fileExists( basePath & FilePath )){

ReferenceDocument = Wirebox.getInstance( "OpenAPIParser@SwaggerSDK" ).init( getDirectoryFromPath( getBaseDocumentPath() ) & $ref );
ReferenceDocument = Wirebox.getInstance( "OpenAPIParser@SwaggerSDK" ).init( basePath & $ref );

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

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

} else if( len( FilePath ) && !fileExists( getDirectoryFromPath( getBaseDocumentPath() ) & FilePath )) {
} else if( len( FilePath ) && !fileExists( basePath & FilePath )) {

throw( type="SwaggerSDK.ParserException", message="File #( getDirectoryFromPath( getBaseDocumentPath() ) & FilePath )# does not exist" );
throw( type="SwaggerSDK.ParserException", message="File #( basePath & FilePath )# does not exist" );

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

Expand Down

0 comments on commit f35cb57

Please sign in to comment.