forked from loafle/openapi-generator-original
* [Ruby] Use Ruby autoload to lower memory usage and load times Fixes #12648 Requiring all models up front can be very expensive in both time and memory if there are many models. In an example client with 6000 models, this would consume nearly 400MB of memory and take about 7 seconds to load. This is mostly unnecessary as most users of the client library will only actually use a small percentage of the library. The changes in this commit use Ruby's autoload capability to defer the loading until the constant is actually used. In that same example client with 6000 models, when initially requiring the library, the memory usage dropped to ~20MB and loaded in 0.3 seconds. As the constants are loaded on-demand, the memory would increase towards that 400MB ceiling, but if only a few constants are actually used, then memory will never actually hit that ceiling. An additional side effect of using Ruby's autoload is that the order of declaring the constants is not important, as Ruby will naturally load them in the correct order when they are needed. Thus, this commit obviates PR #9103 and fixes #4690. * add option to use autoload in ruby client * test ruby clients only * add tests * update samples * Revert "test ruby clients only" This reverts commit 0aaf71cd4cc5d266f824b261a4d312f07bd589e5. * update doc Co-authored-by: Jason Frey <fryguy9@gmail.com>
1.4 KiB
1.4 KiB
Petstore::FormatTest
Properties
Name | Type | Description | Notes |
---|---|---|---|
integer | Integer | [optional] | |
int32 | Integer | [optional] | |
int64 | Integer | [optional] | |
number | Float | ||
float | Float | [optional] | |
double | Float | [optional] | |
decimal | Float | [optional] | |
string | String | [optional] | |
byte | String | ||
binary | File | [optional] | |
date | Date | ||
date_time | Time | [optional] | |
uuid | String | [optional] | |
password | String | ||
pattern_with_digits | String | A string that is a 10 digit number. Can have leading zeros. | [optional] |
pattern_with_digits_and_delimiter | String | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] |
Example
require 'petstore'
instance = Petstore::FormatTest.new(
integer: null,
int32: null,
int64: null,
number: null,
float: null,
double: null,
decimal: null,
string: null,
byte: null,
binary: null,
date: null,
date_time: null,
uuid: 72f98069-206d-4f12-9f12-3d1e525a8e84,
password: null,
pattern_with_digits: null,
pattern_with_digits_and_delimiter: null
)