Skip to content

Commit

Permalink
Fix failing states spec for dry schema
Browse files Browse the repository at this point in the history
  • Loading branch information
styd committed Nov 14, 2020
1 parent a5c453a commit 800f6da
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 12 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Expand Up @@ -3,8 +3,6 @@ Gemfile.lock
log/*.log
pkg/
/*.json
coverage/.resultset.*
coverage/index.html
coverage/assets/
coverage/
tmp/
.idea
5 changes: 0 additions & 5 deletions coverage/.last_run.json

This file was deleted.

2 changes: 1 addition & 1 deletion lib/apex_charts/options/dry_schema/schema.rb
Expand Up @@ -16,7 +16,7 @@ def check(hash)
end

def keys
definition.send(:key_map).map{|key| key.dump.to_sym }
definition.send(:key_map).map{|key| key.name.to_sym }
end
end
end
Expand Down
15 changes: 12 additions & 3 deletions lib/apex_charts/options/dry_schema/states_options.rb
@@ -1,12 +1,21 @@
# frozen_string_literal: true

require_relative 'states_options/filter'

module ApexCharts::Options
module DrySchema
class StatesOptions < Schema
define do
optional(:active)
optional(:hover)
optional(:normal)
optional(:active).hash do
optional(:allowMultipleDataPointsSelection) { bool? }
optional(:filter).hash(Filter)
end
optional(:hover).hash do
optional(:filter).hash(Filter)
end
optional(:normal).hash do
optional(:filter).hash(Filter)
end
end
end
end
Expand Down
10 changes: 10 additions & 0 deletions lib/apex_charts/options/dry_schema/states_options/filter.rb
@@ -0,0 +1,10 @@
# frozen_string_literal: true

module ApexCharts::Options
module DrySchema
Filter = ::Dry::Schema.Params do
optional(:type) { str? }
optional(:value) { int? | float? }
end
end
end

0 comments on commit 800f6da

Please sign in to comment.