graphql-models_connect 1.0.0 → 1.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 64da9a68fd9997f53eef17ed0a1288019d515b423224200f3bcd4c0c1cf2d8e5
4
- data.tar.gz: 9aa63d18f382e1b939ced756159f1c88480ef2ca9bbebfb691cb1763ddde1647
3
+ metadata.gz: d4ca2f8e411e9bc8dc957d4a5572eb672d34b2d1d4a53cee64d247da720026e0
4
+ data.tar.gz: 4fdf99d8d66d3ae42c9bba5c7ed437f8cf0d2fe6f10b9adc6d6ded6e5cbeff6a
5
5
  SHA512:
6
- metadata.gz: dd2bea7f7ee51a1f60fc7e3faf623d9974e94ab9b67984a270ada607bcfd93a70c4045c0aaa49e599371d2c90a4c4cbf7f300709ffb9b62b53740ea130a527a3
7
- data.tar.gz: 8801edf4b01c755b7dee4d370bbcd988af30479b2759b940dae80c76d49c0b9e5e94fe74f6cf077eaa1e7d5c3686280854e08167f8d20f0636af8119d434631a
6
+ metadata.gz: 62458c968b1103ccb50ead589f6639f50c6f501d273ca0a83dfe1e849bff3149ea796cdd5165f43bfaef93d3f78a6a02a3e5ad2338e51be750c5d6579e14ed82
7
+ data.tar.gz: f629f4392a2fcd64c1dd97ea841318ec3245e0f1b583cbebdb510c3a0c50ed8e5386c994ff2b90117d501515e4e93c1cfb6bedf2c269247620a60bb754394057
data/CHANGELOG.md CHANGED
@@ -8,6 +8,12 @@
8
8
  ### Bug fixes
9
9
  )-->
10
10
 
11
+ ## 1.1.0 2025-04-14
12
+
13
+ ### New features
14
+
15
+ - Added model_connect integration for interfaces.
16
+
11
17
  ## 1.0.0 2024-10-09
12
18
 
13
19
  First release. Refer to [README.md](README.md) for the full documentation.
data/README.md CHANGED
@@ -44,6 +44,8 @@ module Types
44
44
  end
45
45
  ```
46
46
 
47
+ The same methods are defined for interfaces.
48
+
47
49
  ## Version numbers
48
50
 
49
51
  GraphQL Models Connect loosely follows [Semantic Versioning](https://semver.org/), with a hard guarantee that breaking changes to the public API will always coincide with an increase to the `MAJOR` number.
@@ -0,0 +1,32 @@
1
+ require_relative 'lib/graphql/models_connect/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = 'graphql-models_connect'
5
+ spec.version = GraphQL::ModelsConnect::VERSION
6
+ spec.authors = ['Moku S.r.l.', 'Riccardo Agatea']
7
+ spec.email = ['info@moku.io']
8
+ spec.license = 'MIT'
9
+
10
+ spec.summary = 'Directly link GraphQL types to underlying models.'
11
+ spec.description = 'Directly link GraphQL types to underlying models.'
12
+ spec.homepage = 'https://github.com/moku-io/graphql-models_connect'
13
+ spec.required_ruby_version = '>= 3.0.0'
14
+
15
+ spec.metadata['homepage_uri'] = spec.homepage
16
+ spec.metadata['source_code_uri'] = 'https://github.com/moku-io/graphql-models_connect'
17
+ spec.metadata['changelog_uri'] = 'https://github.com/moku-io/graphql-models_connect/blob/master/CHANGELOG.md'
18
+
19
+ # Specify which files should be added to the gem when it is released.
20
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
+ spec.files = Dir.chdir File.expand_path(__dir__) do
22
+ `git ls-files -z`.split("\x0").reject do |f|
23
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
24
+ end
25
+ end
26
+ spec.bindir = 'exe'
27
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ['lib']
29
+
30
+ spec.add_dependency 'activesupport'
31
+ spec.add_dependency 'graphql', '~> 2.0'
32
+ end
@@ -0,0 +1,25 @@
1
+ module GraphQL
2
+ class Schema
3
+ module Interface
4
+ definition_methods do
5
+ def model_class new_model_class=nil
6
+ if new_model_class.nil?
7
+ @model_class ||= default_model_class
8
+ else
9
+ @model_class = new_model_class
10
+ end
11
+ end
12
+
13
+ def default_model_class
14
+ raise 'You must set an explicit model for anonymous graphql interfaces' if name.nil?
15
+
16
+ default_model_name = name.delete_suffix 'Type'
17
+
18
+ raise "No default model found for #{name}" unless const_defined? default_model_name
19
+
20
+ const_get default_model_name
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,5 +1,5 @@
1
1
  module GraphQL
2
2
  module ModelsConnect
3
- VERSION = '1.0.0'
3
+ VERSION = '1.1.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql-models_connect
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Moku S.r.l.
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2024-10-09 00:00:00.000000000 Z
12
+ date: 2025-04-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -52,8 +52,10 @@ files:
52
52
  - LICENSE
53
53
  - README.md
54
54
  - Rakefile
55
+ - graphql-models_connect.gemspec
55
56
  - lib/graphql/models_connect.rb
56
57
  - lib/graphql/models_connect/dsl.rb
58
+ - lib/graphql/models_connect/dsl/graphql/schema/interface.rb
57
59
  - lib/graphql/models_connect/dsl/graphql/schema/object.rb
58
60
  - lib/graphql/models_connect/version.rb
59
61
  homepage: https://github.com/moku-io/graphql-models_connect
@@ -78,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
80
  - !ruby/object:Gem::Version
79
81
  version: '0'
80
82
  requirements: []
81
- rubygems_version: 3.5.20
83
+ rubygems_version: 3.5.22
82
84
  signing_key:
83
85
  specification_version: 4
84
86
  summary: Directly link GraphQL types to underlying models.