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
We're using API generator for Ruby to generate OpenAPI clients from the spec file.
We've just generated new client using version 7.12.0 but this resulted in numerous breaking changes.
Those were caused by additions in #20672 that weren't marked as breaking.
Is raising errors on initialization a sensible approach? This feels slightly off. Consider a example API entity of user with required name attribute.
Calling generated model initialization method without arguments like
MyApi::User.new
Was working previously but will now raise an error as the name would be assigned to nil and the changes in setter method name= will mean it immediately fails.
In our apps this has manifested mostly in two places:
specs constructing API gem models through FactoryBot no longer work. Workaround is to make sure to use FactoryBot initialize_with declaration, otherwise I think default behaviour is to initialize empty model and then mass assign attributes later
Pact tests that were previously using partial responses for verification of what's required, now need every required field present, otherwise they will raise errors on initialization too.
Keen for any potential workarounds and other thoughts. Again the change was not noted as breaking but has got considerable knock on effect.
The text was updated successfully, but these errors were encountered:
We're using API generator for Ruby to generate OpenAPI clients from the spec file.
We've just generated new client using version 7.12.0 but this resulted in numerous breaking changes.
Those were caused by additions in #20672 that weren't marked as breaking.
Is raising errors on initialization a sensible approach? This feels slightly off. Consider a example API entity of user with required name attribute.
Calling generated model initialization method without arguments like
Was working previously but will now raise an error as the
name
would be assigned to nil and the changes in setter methodname=
will mean it immediately fails.In our apps this has manifested mostly in two places:
initialize_with
declaration, otherwise I think default behaviour is to initialize empty model and then mass assign attributes laterKeen for any potential workarounds and other thoughts. Again the change was not noted as breaking but has got considerable knock on effect.
The text was updated successfully, but these errors were encountered: