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 +4 -4
- data/.release-please-manifest.json +1 -1
- data/.rubocop.yml +0 -4
- data/CHANGELOG.md +8 -0
- data/README.md +0 -2
- data/lib/schema/array_headers.rb +3 -0
- data/lib/schema/parsers/array.rb +2 -0
- data/lib/schema/parsers/common.rb +1 -1
- data/lib/schema/parsers/hash.rb +2 -0
- data/lib/schema/parsers/json.rb +2 -0
- data/lib/schema/version.rb +1 -1
- data/lib/schema-model.rb +0 -1
- data/schema-model.gemspec +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cd3db69d1a56251cda03284c2af23954d69d79e697fa74c47d564eb1ceb9ddb7
|
|
4
|
+
data.tar.gz: 79687f0746ef3ea15c78b9ca99baf650b361e31e7ef2f7612f54da6e6fc2ec2d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 96fa7aa88bbc344fe24dbb245c7e2f3bc90a2dccda8386a41a0171eedb740ca15b3413bf6f73db4ef4f642e21142b83acf6a3de4f136e3b70e87a4e7752bb052
|
|
7
|
+
data.tar.gz: 7b0e3e1960f407ca135516910340b7f05679f1fd12ebed0efe66b4865b8f9d96ea73d64156bc60d45a3298a3be1aaa95cb2c2a34c82af1282438a69b0707ee45
|
data/.rubocop.yml
CHANGED
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
|
data/lib/schema/array_headers.rb
CHANGED
|
@@ -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)
|
data/lib/schema/parsers/array.rb
CHANGED
|
@@ -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]
|
|
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)
|
data/lib/schema/parsers/hash.rb
CHANGED
data/lib/schema/parsers/json.rb
CHANGED
data/lib/schema/version.rb
CHANGED
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.
|
|
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: '
|
|
90
|
+
version: '3.2'
|
|
91
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
92
|
requirements:
|
|
93
93
|
- - ">="
|