Adds default_value_for_enum_attributes method to Schemable::Definition

This commit is contained in:
Muhammad Nawzad 2024-01-29 10:53:20 +03:00
parent 33a11e95a3
commit 5b32cb2b95
No known key found for this signature in database
GPG Key ID: B954B6AAE33940B2
2 changed files with 14 additions and 0 deletions

View File

@ -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.

View File

@ -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])