File tree Expand file tree Collapse file tree 7 files changed +42
-14
lines changed
ruby-faraday/lib/openapi_client
ruby-httpx/lib/openapi_client
ruby-typhoeus/lib/openapi_client
petstore/ruby-autoload/lib/petstore
extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias
dynamic-servers/ruby/lib/dynamic_servers
generate-alias-as-model/ruby-client/lib/petstore Expand file tree Collapse file tree 7 files changed +42
-14
lines changed Original file line number Diff line number Diff line change @@ -322,9 +322,13 @@ def convert_to_type(data, return_type)
322322 data . each { |k , v | hash [ k ] = convert_to_type ( v , sub_type ) }
323323 end
324324 else
325- # models (e.g. Pet) or oneOf
325+ # models (e.g. Pet) or oneOf/anyOf
326326 klass = OpenapiClient . const_get ( return_type )
327- klass . respond_to? ( :openapi_one_of ) ? klass . build ( data ) : klass . build_from_hash ( data )
327+ if klass . respond_to? ( :openapi_one_of ) || klass . respond_to? ( :openapi_any_of )
328+ klass . build ( data )
329+ else
330+ klass . build_from_hash ( data )
331+ end
328332 end
329333 end
330334
Original file line number Diff line number Diff line change @@ -255,9 +255,13 @@ def convert_to_type(data, return_type)
255255 data . each { |k , v | hash [ k ] = convert_to_type ( v , sub_type ) }
256256 end
257257 else
258- # models (e.g. Pet) or oneOf
258+ # models (e.g. Pet) or oneOf/anyOf
259259 klass = OpenapiClient . const_get ( return_type )
260- klass . respond_to? ( :openapi_one_of ) ? klass . build ( data ) : klass . build_from_hash ( data )
260+ if klass . respond_to? ( :openapi_one_of ) || klass . respond_to? ( :openapi_any_of )
261+ klass . build ( data )
262+ else
263+ klass . build_from_hash ( data )
264+ end
261265 end
262266 end
263267
Original file line number Diff line number Diff line change @@ -278,9 +278,13 @@ def convert_to_type(data, return_type)
278278 data . each { |k , v | hash [ k ] = convert_to_type ( v , sub_type ) }
279279 end
280280 else
281- # models (e.g. Pet) or oneOf
281+ # models (e.g. Pet) or oneOf/anyOf
282282 klass = OpenapiClient . const_get ( return_type )
283- klass . respond_to? ( :openapi_one_of ) ? klass . build ( data ) : klass . build_from_hash ( data )
283+ if klass . respond_to? ( :openapi_one_of ) || klass . respond_to? ( :openapi_any_of )
284+ klass . build ( data )
285+ else
286+ klass . build_from_hash ( data )
287+ end
284288 end
285289 end
286290
Original file line number Diff line number Diff line change @@ -278,9 +278,13 @@ def convert_to_type(data, return_type)
278278 data . each { |k , v | hash [ k ] = convert_to_type ( v , sub_type ) }
279279 end
280280 else
281- # models (e.g. Pet) or oneOf
281+ # models (e.g. Pet) or oneOf/anyOf
282282 klass = Petstore . const_get ( return_type )
283- klass . respond_to? ( :openapi_one_of ) ? klass . build ( data ) : klass . build_from_hash ( data )
283+ if klass . respond_to? ( :openapi_one_of ) || klass . respond_to? ( :openapi_any_of )
284+ klass . build ( data )
285+ else
286+ klass . build_from_hash ( data )
287+ end
284288 end
285289 end
286290
Original file line number Diff line number Diff line change @@ -278,9 +278,13 @@ def convert_to_type(data, return_type)
278278 data . each { |k , v | hash [ k ] = convert_to_type ( v , sub_type ) }
279279 end
280280 else
281- # models (e.g. Pet) or oneOf
281+ # models (e.g. Pet) or oneOf/anyOf
282282 klass = XAuthIDAlias . const_get ( return_type )
283- klass . respond_to? ( :openapi_one_of ) ? klass . build ( data ) : klass . build_from_hash ( data )
283+ if klass . respond_to? ( :openapi_one_of ) || klass . respond_to? ( :openapi_any_of )
284+ klass . build ( data )
285+ else
286+ klass . build_from_hash ( data )
287+ end
284288 end
285289 end
286290
Original file line number Diff line number Diff line change @@ -277,9 +277,13 @@ def convert_to_type(data, return_type)
277277 data . each { |k , v | hash [ k ] = convert_to_type ( v , sub_type ) }
278278 end
279279 else
280- # models (e.g. Pet) or oneOf
280+ # models (e.g. Pet) or oneOf/anyOf
281281 klass = DynamicServers . const_get ( return_type )
282- klass . respond_to? ( :openapi_one_of ) ? klass . build ( data ) : klass . build_from_hash ( data )
282+ if klass . respond_to? ( :openapi_one_of ) || klass . respond_to? ( :openapi_any_of )
283+ klass . build ( data )
284+ else
285+ klass . build_from_hash ( data )
286+ end
283287 end
284288 end
285289
Original file line number Diff line number Diff line change @@ -277,9 +277,13 @@ def convert_to_type(data, return_type)
277277 data . each { |k , v | hash [ k ] = convert_to_type ( v , sub_type ) }
278278 end
279279 else
280- # models (e.g. Pet) or oneOf
280+ # models (e.g. Pet) or oneOf/anyOf
281281 klass = Petstore . const_get ( return_type )
282- klass . respond_to? ( :openapi_one_of ) ? klass . build ( data ) : klass . build_from_hash ( data )
282+ if klass . respond_to? ( :openapi_one_of ) || klass . respond_to? ( :openapi_any_of )
283+ klass . build ( data )
284+ else
285+ klass . build_from_hash ( data )
286+ end
283287 end
284288 end
285289
You can’t perform that action at this time.
0 commit comments