graphql-schema-directive-constraint 0.2.0 → 0.3.0
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/.rubocop.yml +6 -0
- data/README.md +12 -12
- data/graphql-schema-directive-constraint.gemspec +1 -1
- data/lib/graphql/schema/directive/constraint.rb +14 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9474de7a5dcc0cfd75e6f5950751418a7c3cdf680d98a6e44daf872f7e3f3e33
|
4
|
+
data.tar.gz: 8c1feefb9dcb12a136caa168b1107a7c7bf57712cc87f8ad3e6f08703ca334b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93a3a0802cbb6281da84c207c748f410e7a0e9609f70423a0832aab9073298c0d6171b270106f80761928f6433183c93bf91b1755c5c9c37269b5e2ca3e5467c
|
7
|
+
data.tar.gz: 2df0a5065089e369c0dbf10733e1aab1c243012a9d9621efd84caa29375d35f6ab254ff4b184fba6469a655a7da5dcf181258e95de010582d66325d728eb97ed
|
data/.rubocop.yml
CHANGED
data/README.md
CHANGED
@@ -93,18 +93,18 @@ This example only generates `@constraint` directive on schema but it does not va
|
|
93
93
|
- [x] constraint
|
94
94
|
- [ ] validator
|
95
95
|
- [ ] Integer
|
96
|
-
- [
|
97
|
-
- [
|
98
|
-
- [
|
99
|
-
- [
|
100
|
-
- [
|
101
|
-
- [
|
102
|
-
- [
|
103
|
-
- [
|
104
|
-
- [
|
105
|
-
- [
|
106
|
-
- [
|
107
|
-
- [
|
96
|
+
- [x] min
|
97
|
+
- [x] constraint
|
98
|
+
- [x] validator
|
99
|
+
- [x] max
|
100
|
+
- [x] constraint
|
101
|
+
- [x] validator
|
102
|
+
- [x] exclusiveMin
|
103
|
+
- [x] constraint
|
104
|
+
- [x] validator
|
105
|
+
- [x] exclusiveMax
|
106
|
+
- [x] constraint
|
107
|
+
- [x] validator
|
108
108
|
- [ ] multipleOf
|
109
109
|
- [ ] constraint
|
110
110
|
- [ ] validator
|
@@ -32,6 +32,12 @@ module GraphQL
|
|
32
32
|
argument(:pattern, String, description: "Ensure value matches regex, e.g. alphanumeric", required: false)
|
33
33
|
argument(:format, String, description: "Ensure value is in a particular format", required: false)
|
34
34
|
|
35
|
+
argument(:min, Integer, description: "Ensure value is greater than or equal to", required: false)
|
36
|
+
argument(:max, Integer, description: "Ensure value is less than or equal to", required: false)
|
37
|
+
argument(:exclusiveMin, Integer, description: "Ensure value is greater than", required: false)
|
38
|
+
argument(:exclusiveMax, Integer, description: "Ensure value is less than", required: false)
|
39
|
+
argument(:multipleOf, Integer, description: "Ensure value is a multiple", required: false)
|
40
|
+
|
35
41
|
argument(:without_validator, Boolean, description: "Use constraint directive without validator", required: false)
|
36
42
|
|
37
43
|
locations(
|
@@ -53,6 +59,14 @@ module GraphQL
|
|
53
59
|
owner.validates({ length: { maximum: maxLength } })
|
54
60
|
in [:pattern, pattern]
|
55
61
|
owner.validates({ format: { with: pattern } })
|
62
|
+
in [:min, min]
|
63
|
+
owner.validates({ numericality: { greater_than_or_equal_to: min } })
|
64
|
+
in [:max, max]
|
65
|
+
owner.validates({ numericality: { less_than_or_equal_to: max } })
|
66
|
+
in [:exclusiveMin, exclusiveMin]
|
67
|
+
owner.validates({ numericality: { greater_than: exclusiveMin } })
|
68
|
+
in [:exclusiveMax, exclusiveMax]
|
69
|
+
owner.validates({ numericality: { less_than: exclusiveMax } })
|
56
70
|
else
|
57
71
|
raise NotImplementedError("Given arguments are not implemented yet")
|
58
72
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql-schema-directive-constraint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryota Yoshikawa
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: graphql
|
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
requirements: []
|
112
|
-
rubygems_version: 3.2.
|
112
|
+
rubygems_version: 3.2.33
|
113
113
|
signing_key:
|
114
114
|
specification_version: 4
|
115
115
|
summary: Allows using @constraint as a directive to validate input data.
|