mirror of
https://github.com/ditkrg/schemable.git
synced 2026-01-22 22:26:41 +00:00
Fixes typos and ensures type safety
This commit is contained in:
parent
26ec4d9214
commit
dc89944058
@ -62,7 +62,7 @@ module Schemable
|
|||||||
attribute_hash = @model.fields[attribute.to_s]
|
attribute_hash = @model.fields[attribute.to_s]
|
||||||
|
|
||||||
# Check if this attribute has a custom JSON Schema definition
|
# Check if this attribute has a custom JSON Schema definition
|
||||||
return @model_definition.array_types[attribute] if @model_definition.array_types.keys.include?(attribute)
|
return @model_definition.array_types[attribute] if @model_definition.array_types.keys.include?(attribute.to_sym)
|
||||||
return @model_definition.additional_response_attributes[attribute] if @model_definition.additional_response_attributes.keys.include?(attribute)
|
return @model_definition.additional_response_attributes[attribute] if @model_definition.additional_response_attributes.keys.include?(attribute)
|
||||||
|
|
||||||
# Check if this is an array attribute
|
# Check if this is an array attribute
|
||||||
@ -81,7 +81,7 @@ module Schemable
|
|||||||
attribute_hash = @model.columns_hash[attribute.to_s]
|
attribute_hash = @model.columns_hash[attribute.to_s]
|
||||||
|
|
||||||
# Check if this attribute has a custom JSON Schema definition
|
# Check if this attribute has a custom JSON Schema definition
|
||||||
return @model_definition.array_types[attribute] if @model_definition.array_types.keys.include?(attribute)
|
return @model_definition.array_types[attribute] if @model_definition.array_types.keys.include?(attribute.to_sym)
|
||||||
return @model_definition.additional_response_attributes[attribute] if @model_definition.additional_response_attributes.keys.include?(attribute)
|
return @model_definition.additional_response_attributes[attribute] if @model_definition.additional_response_attributes.keys.include?(attribute)
|
||||||
|
|
||||||
# Check if this is an array attribute
|
# Check if this is an array attribute
|
||||||
|
|||||||
@ -17,7 +17,7 @@ module Schemable
|
|||||||
:enum_prefix_for_simple_enum,
|
:enum_prefix_for_simple_enum,
|
||||||
:enum_suffix_for_simple_enum,
|
:enum_suffix_for_simple_enum,
|
||||||
:infer_attributes_from_custom_method,
|
:infer_attributes_from_custom_method,
|
||||||
:infer_attributes_from_jsonapi_serializable,
|
:infer_attributes_from_jsonapi_serializable
|
||||||
)
|
)
|
||||||
|
|
||||||
# Initializes a new Configuration instance with default values.
|
# Initializes a new Configuration instance with default values.
|
||||||
@ -46,7 +46,7 @@ module Schemable
|
|||||||
# @param type_name [Symbol, String] The name of the type.
|
# @param type_name [Symbol, String] The name of the type.
|
||||||
# @return [Hash] The type mapper for the given type name.
|
# @return [Hash] The type mapper for the given type name.
|
||||||
def type_mapper(type_name)
|
def type_mapper(type_name)
|
||||||
return @custom_type_mappers[type_name] if @custom_type_mappers.key?(type_name)
|
return @custom_type_mappers[type_name] if @custom_type_mappers.key?(type_name.to_sym)
|
||||||
|
|
||||||
{
|
{
|
||||||
text: { type: :string },
|
text: { type: :string },
|
||||||
|
|||||||
@ -3,7 +3,7 @@ module Schemable
|
|||||||
# It includes methods for handling attributes, relationships, and various request and response attributes.
|
# It includes methods for handling attributes, relationships, and various request and response attributes.
|
||||||
# The definition class is meant to be inherited by a class that represents a model.
|
# The definition class is meant to be inherited by a class that represents a model.
|
||||||
# This class should be configured to match the model's attributes and relationships.
|
# This class should be configured to match the model's attributes and relationships.
|
||||||
# The defaullt configuration is set in this class, but can be overridden in the model's definition class.
|
# The default configuration is set in this class, but can be overridden in the model's definition class.
|
||||||
#
|
#
|
||||||
# @see Schemable
|
# @see Schemable
|
||||||
class Definition
|
class Definition
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user