schema-model 0.7.2 → 0.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c75de56a15a674efd32d16fdedda825e056c4b71e6e3a1d20c63761ae685c5c2
4
- data.tar.gz: 25537f375a8da4d892bc4c6950e790d8db3b0859f925d302d27b9bef82a773f9
3
+ metadata.gz: cd3db69d1a56251cda03284c2af23954d69d79e697fa74c47d564eb1ceb9ddb7
4
+ data.tar.gz: 79687f0746ef3ea15c78b9ca99baf650b361e31e7ef2f7612f54da6e6fc2ec2d
5
5
  SHA512:
6
- metadata.gz: ec765c52a43b319a6e47879239f92f268a6c7c359163c001c2d9411f286fa41f7036a6739adf4e3f6531f7f9becc5c191c5ef51610f1128903d94a5f4ab6653e
7
- data.tar.gz: 39dc1faf72f89f17dc75909421e1b1cc4c1d3e1b04db03661716f4f772a0ef5051ad8046e284ff34185b0da4dc27fdb44aaf720d7441a795fae18cd89c4f36a8
6
+ metadata.gz: 96fa7aa88bbc344fe24dbb245c7e2f3bc90a2dccda8386a41a0171eedb740ca15b3413bf6f73db4ef4f642e21142b83acf6a3de4f136e3b70e87a4e7752bb052
7
+ data.tar.gz: 7b0e3e1960f407ca135516910340b7f05679f1fd12ebed0efe66b4865b8f9d96ea73d64156bc60d45a3298a3be1aaa95cb2c2a34c82af1282438a69b0707ee45
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "0.7.2"
2
+ ".": "0.7.3"
3
3
  }
data/.rubocop.yml CHANGED
@@ -48,10 +48,6 @@ Naming/FileName:
48
48
  Exclude:
49
49
  - 'lib/schema-model.rb'
50
50
 
51
- # Gemspec settings
52
- Gemspec/RequiredRubyVersion:
53
- Enabled: false
54
-
55
51
  # DSL methods following ActiveRecord conventions (has_one, has_many)
56
52
  Naming/PredicatePrefix:
57
53
  Exclude:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.7.3](https://github.com/dougyouch/schema/compare/v0.7.2...v0.7.3) (2026-10-04)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **array-headers:** map aliased associations once under their name ([20258e2](https://github.com/dougyouch/schema/commit/20258e22bb59bbfaac088a71dccd773b7ef9255c))
9
+ * **parsers:** accept signed exponents and treat nil as nil for array, hash and json ([d4ac539](https://github.com/dougyouch/schema/commit/d4ac539ceba92354b47504523c18bbe3ed209e09))
10
+
3
11
  ## [0.7.2](https://github.com/dougyouch/schema/compare/v0.7.1...v0.7.2) (2026-10-04)
4
12
 
5
13
 
data/README.md CHANGED
@@ -82,8 +82,6 @@ attribute :metadata, :hash # Hash/dictionary values
82
82
  attribute :config, :json # Parse JSON strings
83
83
  ```
84
84
 
85
- Unlike the basic types, `:array`, `:hash` and `:json` record an `incompatible` parsing error when given `nil`.
86
-
87
85
  ## Attribute Options
88
86
 
89
87
  ### Aliases
@@ -75,6 +75,8 @@ module Schema
75
75
  def map_headers_to_has_one_associations(headers, mapped_headers, header_prefix)
76
76
  schema.each do |field_name, field_options|
77
77
  next unless field_options[:type] == :has_one
78
+ # aliases are matched through the association's own entry
79
+ next if field_options[:alias_of]
78
80
 
79
81
  mapped_model = get_mapped_model(field_options, headers, header_prefix)
80
82
  next if mapped_model.empty?
@@ -87,6 +89,7 @@ module Schema
87
89
  def map_headers_to_has_many_associations(headers, mapped_headers)
88
90
  schema.each do |field_name, field_options|
89
91
  next unless field_options[:type] == :has_many
92
+ next if field_options[:alias_of]
90
93
 
91
94
  get_header_prefixes(field_name, field_options).each do |header_prefix|
92
95
  mapped_model = get_mapped_model(field_options, headers, header_prefix)
@@ -17,6 +17,8 @@ module Schema
17
17
 
18
18
  parsing_errors.add(field_name, ::Schema::ParsingErrors::INCOMPATIBLE)
19
19
  nil
20
+ when nil
21
+ nil
20
22
  else
21
23
  parsing_errors.add(field_name, ::Schema::ParsingErrors::INCOMPATIBLE)
22
24
  nil
@@ -7,7 +7,7 @@ module Schema
7
7
  # Schema::Parsers::Common are parser methods for basic types
8
8
  module Common
9
9
  INTEGER_REGEX = /\A[-+]?(?:[1-9]\d*|0)(?:\.0+)?\z/
10
- FLOAT_REGEX = /\A[-+]?(?:[1-9]\d*|0)(?:\.\d+)?([Ee]-?\d+)?\z/
10
+ FLOAT_REGEX = /\A[-+]?(?:[1-9]\d*|0)(?:\.\d+)?([Ee][-+]?\d+)?\z/
11
11
  BOOLEAN_REGEX = /\A(?:1|t|true|on|y|yes)\z/i
12
12
 
13
13
  def parse_integer(field_name, parsing_errors, value)
@@ -8,6 +8,8 @@ module Schema
8
8
  case value
9
9
  when ::Hash
10
10
  value
11
+ when nil
12
+ nil
11
13
  else
12
14
  parsing_errors.add(field_name, ::Schema::ParsingErrors::INCOMPATIBLE)
13
15
  nil
@@ -15,6 +15,8 @@ module Schema
15
15
  parsing_errors.add(field_name, ::Schema::ParsingErrors::INVALID)
16
16
  nil
17
17
  end
18
+ when nil
19
+ nil
18
20
  else
19
21
  parsing_errors.add(field_name, ::Schema::ParsingErrors::INCOMPATIBLE)
20
22
  nil
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Schema
4
4
  # Gem version, bumped by release-please
5
- VERSION = '0.7.2'
5
+ VERSION = '0.7.3'
6
6
  end
data/lib/schema-model.rb CHANGED
@@ -24,7 +24,6 @@ module Schema
24
24
  autoload :Arrays, 'schema/arrays'
25
25
  autoload :CSVParser, 'schema/csv_parser'
26
26
  autoload :Errors, 'schema/errors'
27
- autoload :CSVParser, 'schema/csv_parser'
28
27
  autoload :Model, 'schema/model'
29
28
  autoload :ParsingErrors, 'schema/parsing_errors'
30
29
  autoload :Utils, 'schema/utils'
data/schema-model.gemspec CHANGED
@@ -15,6 +15,7 @@ Gem::Specification.new do |s|
15
15
  s.email = 'dougyouch@gmail.com'
16
16
  s.homepage = 'https://github.com/dougyouch/schema'
17
17
  s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ s.required_ruby_version = '>= 3.2'
18
19
  s.bindir = 'bin'
19
20
  s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
21
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schema-model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Doug Youch
@@ -87,7 +87,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
87
87
  requirements:
88
88
  - - ">="
89
89
  - !ruby/object:Gem::Version
90
- version: '0'
90
+ version: '3.2'
91
91
  required_rubygems_version: !ruby/object:Gem::Requirement
92
92
  requirements:
93
93
  - - ">="