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
{{ message }}
Repository navigation
[BUG][RUBY] Property named ObjectId generates attr_accessor :object_id, overriding Object#object_id #25174
When a schema has a property called ObjectId or object_id, the ruby client generator emits attr_accessor :object_id on the model. That overrides Object#object_id, which Ruby uses for object identity. Ruby warns about it at load time:
warning: redefining 'object_id' may cause serious problems
On Ruby 3.4 this warning prints by default, so every app that loads such a gem gets it, even without -W. It's also a real bug: anything that relies on object_id (identity-keyed caches, ObjectSpace._id2ref, debuggers) gets the API field value back instead of the object's id. Before the attribute is set, it gets nil.
object_id isn't in the Ruby generator's reserved words list. send was added to that list for the same reason in #3146. The Crystal generator added object_id in #22577.
openapi-generator version
Current master (7.27.0-SNAPSHOT). This isn't a regression; the reserved list has never included object_id.
In the wild: the Xero Ruby SDK ships this exact accessor (XeroAPI/xero-ruby#327, XeroAPI/xero-ruby#354). Its maintainers can't patch generated code by hand, so it needs a fix here.
Suggest a fix
Add object_id to the reserved words in RubyClientCodegen, next to send. PR to follow.
Activity
[ruby] Add object_id to reserved words (OpenAPITools#25175)