graphiti 1.3.4 → 1.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cbdb96a78aeac1f48bcea53a3b068638456e703b17fccf68d2f3813270db4bd8
4
- data.tar.gz: c1dab2eff065e8ba70193cac81c6c5c44c57f81f9074082887ed7b52f2bcb000
3
+ metadata.gz: 4add496faa756dcfd1d5980628d722b0d41bc9acfdf27d04cb55db15d7e3bba7
4
+ data.tar.gz: a991debe7ba1204c30388b4b3174e7fdfaf7446e7d777f3030d18296975a096e
5
5
  SHA512:
6
- metadata.gz: 1a860a2d6cc8bfc494207ddd6bac1643c58ba09148fdf85b07c9198840728ace0f752fefb94bafa6599a97eb5ccfa6408544b08312aca5c6e01d77c874141821
7
- data.tar.gz: 4a821372147d76d03a6d3e4dc5dce6ca205464d852892484567f725355459b0d5477418340ed9d53831a0062218e7b9daaf3560a0951c2decd8fd177a499954b
6
+ metadata.gz: d6e1253418d35ce742bc1365e1f18268548ac62f180d6c606420df18f75261d3a562495e2b0213788993bdb34102b5450664e6f5124cdf713cdb3ad40af71b1f
7
+ data.tar.gz: dd65210486a8b212571184d71c28feaaeb3540e85a3964ed54248a193034ebece099bba186672488642093a727d47d021210ee56f26d6e37739cc72f6d52a414
@@ -151,7 +151,8 @@ module Graphiti
151
151
  readable: true,
152
152
  writable: false,
153
153
  sortable: false,
154
- filterable: false
154
+ filterable: false,
155
+ schema: true
155
156
  }
156
157
  options = defaults.merge(options)
157
158
  attribute_option(options, :readable)
@@ -153,6 +153,8 @@ module Graphiti
153
153
  def extra_attributes(resource)
154
154
  {}.tap do |attrs|
155
155
  resource.extra_attributes.each_pair do |name, config|
156
+ next unless config[:schema]
157
+
156
158
  attrs[name] = {
157
159
  type: config[:type].to_s,
158
160
  readable: flag(config[:readable]),
@@ -181,11 +183,11 @@ module Graphiti
181
183
  def sorts(resource)
182
184
  {}.tap do |s|
183
185
  resource.sorts.each_pair do |name, sort|
184
- next unless resource.attributes[name][:schema]
186
+ attr = resource.all_attributes[name]
187
+ next unless attr[:schema]
185
188
 
186
189
  config = {}
187
190
  config[:only] = sort[:only] if sort[:only]
188
- attr = resource.attributes[name]
189
191
  if attr[:sortable].is_a?(Symbol)
190
192
  config[:guard] = true
191
193
  end
@@ -209,7 +211,7 @@ module Graphiti
209
211
  config[:deny] = filter[:deny].map(&:to_s) if filter[:deny]
210
212
  config[:dependencies] = filter[:dependencies].map(&:to_s) if filter[:dependencies]
211
213
 
212
- attr = resource.attributes[name]
214
+ attr = resource.all_attributes[name]
213
215
  if attr[:filterable].is_a?(Symbol)
214
216
  if attr[:filterable] == :required
215
217
  config[:required] = true
@@ -1,3 +1,3 @@
1
1
  module Graphiti
2
- VERSION = "1.3.4"
2
+ VERSION = "1.3.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphiti
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.4
4
+ version: 1.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lee Richmond
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-01 00:00:00.000000000 Z
11
+ date: 2021-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jsonapi-serializable
@@ -361,7 +361,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
361
361
  - !ruby/object:Gem::Version
362
362
  version: '0'
363
363
  requirements: []
364
- rubygems_version: 3.1.6
364
+ rubygems_version: 3.2.22
365
365
  signing_key:
366
366
  specification_version: 4
367
367
  summary: Easily build jsonapi.org-compatible APIs