diff --git a/lib/schemable/definition.rb b/lib/schemable/definition.rb index 0768f9f..9fb2773 100644 --- a/lib/schemable/definition.rb +++ b/lib/schemable/definition.rb @@ -265,6 +265,19 @@ module Schemable %i[] end + # Returns the default value for the enum attributes. + # + # @example + # { + # status: 'pending', + # flag: 0 + # } + # + # @return [Hash] The custom default values for the enum attributes. + def default_value_for_enum_attributes + {} + end + # Returns an instance of the model class that is already serialized into jsonapi format. # # @return [Hash] The serialized instance of the model class. diff --git a/sig/schemable/definition.rbs b/sig/schemable/definition.rbs index 18db060..64ac8bd 100644 --- a/sig/schemable/definition.rbs +++ b/sig/schemable/definition.rbs @@ -25,6 +25,7 @@ module Schemable def excluded_update_request_attributes: -> Array[Symbol] def optional_create_request_attributes: -> Array[Symbol] def optional_update_request_attributes: -> Array[Symbol] + def default_value_for_enum_attributes: -> Hash[Symbol, any] def additional_create_request_attributes: -> Hash[Symbol, any] def additional_update_request_attributes: -> Hash[Symbol, any] def camelize_keys: (Hash[Symbol, any]) -> (Array[Hash[Symbol, any]] | Hash[Symbol, any])