Skip to content

Commit 9131d0a

Browse files
committed
revert usage of $ref in parser instantiation
1 parent 16168c1 commit 9131d0a

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

models/OpenAPI/Parser.cfc

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ component name="OpenAPIParser" accessors="true" {
131131
DocItem[ i ] = parseDocumentReferences( DocItem[ i ] );
132132
}
133133
} else if( isStruct( DocItem ) ) {
134-
134+
135135
//handle top-level values, if they exist
136136
if( structKeyExists( DocItem, "$ref" ) ) return fetchDocumentReference( DocItem[ "$ref" ] );
137137

@@ -166,16 +166,16 @@ component name="OpenAPIParser" accessors="true" {
166166
* @param [XPath] The XPath to zoom the parsed document to during recursion
167167
**/
168168
public function parseDocumentInheritance( required any DocItem ){
169-
169+
170170
if( isArray( DocItem ) ) {
171171
for( var i = 1; i <= arrayLen( DocItem ); i++){
172172
DocItem[ i ] = parseDocumentInheritance( DocItem[ i ] );
173173
}
174174
} else if( isStruct( DocItem ) ) {
175-
175+
176176
// handle top-level extension
177-
if(
178-
structKeyExists( DocItem, "$allOf" ) &&
177+
if(
178+
structKeyExists( DocItem, "$allOf" ) &&
179179
isArray( DocItem[ "$allOf" ] )
180180
) {
181181
return extendObject( DocItem[ "$allOf" ] );
@@ -185,7 +185,7 @@ component name="OpenAPIParser" accessors="true" {
185185

186186
if (
187187
isStruct( DocItem[ key ] ) &&
188-
structKeyExists( DocItem[ key ], "$allOf" ) &&
188+
structKeyExists( DocItem[ key ], "$allOf" ) &&
189189
isArray( DocItem[ key ][ "$allOf" ] )
190190
) {
191191
DocItem[ key ] = extendObject( DocItem[ key ][ "$allOf" ] );
@@ -205,25 +205,25 @@ component name="OpenAPIParser" accessors="true" {
205205
* Extends schema definitions based on the passed array of schema objects
206206
* Note: Ignores CFML objects (non-structs) because sometimes the parser gets passed in here for some reason
207207
*
208-
* @objects
208+
* @objects
209209
*/
210210
function extendObject( array objects ) {
211211
var output = {
212212
"type": "object"
213213
};
214214
objects.each( function( item, index ) {
215-
if ( isStruct( item ) ) {
215+
if ( isStruct( item ) ) {
216216
item.each( function( key, value ) {
217-
218-
if (
217+
218+
if (
219219
output.keyExists( key ) &&
220220
isStruct( output[ key ] )
221221
) {
222222
output[ key ].append( value, true );
223223
} else {
224224
output[ key ] = value
225225
}
226-
226+
227227
} );
228228
}
229229
} );
@@ -280,7 +280,7 @@ component name="OpenAPIParser" accessors="true" {
280280

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

283-
ReferenceDocument = Wirebox.getInstance( "OpenAPIParser@SwaggerSDK" ).init( getDirectoryFromPath( getBaseDocumentPath() ) & FilePath );
283+
ReferenceDocument = Wirebox.getInstance( "OpenAPIParser@SwaggerSDK" ).init( getDirectoryFromPath( getBaseDocumentPath() ) & $ref );
284284

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

@@ -309,7 +309,7 @@ component name="OpenAPIParser" accessors="true" {
309309

310310
}
311311

312-
return ReferenceDocument.getNormalizedDocument();
312+
return ReferenceDocument;
313313
}
314314

315315
/**

0 commit comments

Comments
 (0)