You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
After importing the API spec for commercetools, the newly created ruby client is unable to load the class Message. An issue was initially opened with commercetools regarding the spec, but after being able to properly generate the client, we are still unable to properly initialize the client via both our rails application and the regular irb console.
hackathon-ct-sdk ➜ irb
irb(main):001:0> require 'hackathon_ct_sdk'
Traceback (most recent call last):
14: from /Users/mirandashort/.rbenv/versions/2.7.4/bin/ruby_executable_hooks:22:in `<main>'
13: from /Users/mirandashort/.rbenv/versions/2.7.4/bin/ruby_executable_hooks:22:in `eval'
12: from /Users/mirandashort/.rbenv/versions/2.7.4/bin/irb:23:in `<main>'
11: from /Users/mirandashort/.rbenv/versions/2.7.4/bin/irb:23:in `load'
10: from /Users/mirandashort/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/irb-1.2.6/exe/irb:11:in `<top (required)>'
9: from (irb):1
8: from /Users/mirandashort/.rbenv/versions/2.7.4/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:147:in `require'
7: from /Users/mirandashort/.rbenv/versions/2.7.4/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:158:in `rescue in require'
6: from /Users/mirandashort/.rbenv/versions/2.7.4/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:158:in `require'
5: from /Users/mirandashort/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/hackathon_ct_sdk-1.0.0/lib/hackathon_ct_sdk.rb:1176:in `<top (required)>'
4: from /Users/mirandashort/.rbenv/versions/2.7.4/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
3: from /Users/mirandashort/.rbenv/versions/2.7.4/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
2: from /Users/mirandashort/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/hackathon_ct_sdk-1.0.0/lib/hackathon_ct_sdk/models/category_created_message.rb:16:in `<top (required)>'
1: from /Users/mirandashort/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/hackathon_ct_sdk-1.0.0/lib/hackathon_ct_sdk/models/category_created_message.rb:17:in `<module:HackathonCtSdk>'
NameError (uninitialized constant HackathonCtSdk::Message)
Did you mean? HackathonCtSdk::MessageAllOf
Related issues/PRs
There is an open issue for adding support to autoload classes: #12648
This kind of error is something I do typically encounter in our rails application whenever there is an issue with autoloading classes (specifically if the path does not match the class name), so it could possibly be related. It could also be this issue with inheritance, which does reference the above issue: #4690. It's unclear to me if this is the same issue though.
Suggest a fix
Ultimately the client is unable to load the class Message, but not sure where specifically the code is breaking.
The text was updated successfully, but these errors were encountered:
I actually think it is the same problem as #4690 but it's closed. It looks like when I require 'message' in category_created_message, it now has trouble finding message_all_of. I'm not sure what the actual order needs to be for all classes to get loaded, but it seems to be that they are required in the module alphabetically. Autoloading the classes may fix that.
When you call openapi-generator generate, can you try passing the new useAutoload parameter as it's not the default? This should fix any require ordering issues.
Bug Report Checklist
Description
After importing the API spec for commercetools, the newly created ruby client is unable to load the class
Message
. An issue was initially opened with commercetools regarding the spec, but after being able to properly generate the client, we are still unable to properly initialize the client via both our rails application and the regular irb console.openapi-generator version
OpenAPI declaration file content or url
https://raw.githubusercontent.com/commercetools/commercetools-api-reference/main/oas/openapi.yaml
Generation Details
Install Generator
Create Ruby Client
Steps to reproduce
As defined by setup instructions in the automatically generated client, build the gem and install locally:
Load irb console and require gem:
Related issues/PRs
There is an open issue for adding support to autoload classes: #12648
This kind of error is something I do typically encounter in our rails application whenever there is an issue with autoloading classes (specifically if the path does not match the class name), so it could possibly be related. It could also be this issue with inheritance, which does reference the above issue: #4690. It's unclear to me if this is the same issue though.
Suggest a fix
Ultimately the client is unable to load the class
Message
, but not sure where specifically the code is breaking.The text was updated successfully, but these errors were encountered: