attributor 6.4 → 6.5
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/CHANGELOG.md +3 -0
- data/lib/attributor/types/bigdecimal.rb +15 -3
- data/lib/attributor/version.rb +1 -1
- 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: 9242ef6d878ab79e69393d7bf31b6459873d39a8307c9dac0ea05ce8c4a01912
|
4
|
+
data.tar.gz: 0b2f333abe4957d1575df87c734c4f642274a83d50562059c33fb261154e44a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48a0ea86f5550dd44b0d162ea96c1a98bbd7019955857f607817efe921fc4250c210e2591664d18a9388fd614d323547c83421b64ba678369c47d248423770ca
|
7
|
+
data.tar.gz: dcd17fa9b98e35d02e471ef340b641ba15ff4fafd6f05d5ac650204830ba7cc7a44feaf40b6a2386c660ab17d3b8d0b881d01d84c4a83a46fe41c6552a2ec74d
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
require 'bigdecimal'
|
2
2
|
|
3
3
|
module Attributor
|
4
|
-
class BigDecimal
|
5
|
-
include
|
4
|
+
class BigDecimal
|
5
|
+
include Type
|
6
|
+
|
6
7
|
def self.native_type
|
7
8
|
::BigDecimal
|
8
9
|
end
|
@@ -19,7 +20,18 @@ module Attributor
|
|
19
20
|
end
|
20
21
|
|
21
22
|
def self.json_schema_type
|
22
|
-
:
|
23
|
+
:string
|
24
|
+
end
|
25
|
+
|
26
|
+
# Bigdecimal numbers are too big to be represented as numbers in JSON schema
|
27
|
+
# The way to do so, is to represent them as strings, but add a 'format' specifying
|
28
|
+
# how to parse that (seemingly, there is a 'double' well known type that json API
|
29
|
+
# claims we can use) ... not sure if this is the right one, as technically BigDecimal
|
30
|
+
# has very large precision that a double wouldn't be able to fit...
|
31
|
+
def self.as_json_schema( shallow: false, example: nil, attribute_options: {} )
|
32
|
+
hash = super
|
33
|
+
hash[:format] = 'bigdecimal'
|
34
|
+
hash
|
23
35
|
end
|
24
36
|
end
|
25
37
|
end
|
data/lib/attributor/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: attributor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '6.
|
4
|
+
version: '6.5'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josep M. Blanquer
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2023-01-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hashie
|