mirror of
https://github.com/ditkrg/schemable.git
synced 2026-01-22 22:26:41 +00:00
Sets configuration by default
This commit is contained in:
parent
b480c82361
commit
0118d57cb7
@ -2,10 +2,10 @@ module Schemable
|
|||||||
class AttributeSchemaGenerator
|
class AttributeSchemaGenerator
|
||||||
attr_accessor :model_definition, :configuration, :model, :schema_modifier, :response
|
attr_accessor :model_definition, :configuration, :model, :schema_modifier, :response
|
||||||
|
|
||||||
def initialize(model_definition, configuration)
|
def initialize(model_definition)
|
||||||
@model_definition = model_definition
|
@model_definition = model_definition
|
||||||
@model = model_definition.model
|
@model = model_definition.model
|
||||||
@configuration = configuration
|
@configuration = Schemable.configuration
|
||||||
@schema_modifier = SchemaModifier.new
|
@schema_modifier = SchemaModifier.new
|
||||||
@response = nil
|
@response = nil
|
||||||
end
|
end
|
||||||
@ -14,7 +14,7 @@ module Schemable
|
|||||||
def generate_attributes_schema
|
def generate_attributes_schema
|
||||||
schema = {
|
schema = {
|
||||||
type: :object,
|
type: :object,
|
||||||
properties: @model_definition.attributes&.index_with do |attr|
|
properties: @model_definition.attributes.index_with do |attr|
|
||||||
generate_attribute_schema(attr)
|
generate_attribute_schema(attr)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@ module Schemable
|
|||||||
attr_accessor response: Hash[Symbol, any]?
|
attr_accessor response: Hash[Symbol, any]?
|
||||||
attr_accessor schema_modifier: SchemaModifier
|
attr_accessor schema_modifier: SchemaModifier
|
||||||
|
|
||||||
def initialize: (Definition, Configuration) -> void
|
def initialize: (Definition) -> void
|
||||||
def generate_attributes_schema: -> (Hash[Symbol, any] | Array[any])
|
def generate_attributes_schema: -> (Hash[Symbol, any] | Array[any])
|
||||||
def generate_attribute_schema: (Symbol) -> Hash[Symbol, any]
|
def generate_attribute_schema: (Symbol) -> Hash[Symbol, any]
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user