Skip to content

Commit aa8cee1

Browse files
arutkowski00NuckChorris
authored andcommitted
feat: add @Policy and respect federation_version in link
refactor: fix rubocop offenses ci: add Github Actions (Gusto#4) ci: add missing env variable (Gusto#5) ci: add GEM_HOST_API_KEY (Gusto#6) chore: upgrade packages (Gusto#8) ci: add BUNDLE_FROZEN: false to allow semantic release (Gusto#9) ci: use different github token for release (Gusto#10) feat: add support for @composeDirective (Gusto#3) Co-authored-by: Yannick Utard <[email protected]> chore(release): 3.10.0 [skip ci] * add support for [@compose](https://github.com/compose)Directive ([Gusto#3](mondaycom#3)) ([6d7ccf2](mondaycom@6d7ccf2)) feat: drop old ruby; remove appraisals (Gusto#290) * feat: drop old ruby; remove appraisals * ruby 3.4 fix * Fix feat: update google-protobuf (Gusto#291) * Try new protobuf * Cop * Bump version chore(release): 3.10.0 [skip ci] * update google-protobuf ([Gusto#291](Gusto#291)) ([2deda45](Gusto@2deda45))
1 parent 61c3384 commit aa8cee1

22 files changed

+593
-169
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: "Semantic PR Title"
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
types:
8+
- opened
9+
- edited
10+
- synchronize
11+
- reopened
12+
13+
permissions:
14+
pull-requests: write
15+
16+
jobs:
17+
main:
18+
name: Validate PR title
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: amannn/action-semantic-pull-request@v5
22+
id: lint_pr_title
23+
env:
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- uses: marocchino/sticky-pull-request-comment@v2
27+
# When the previous steps fails, the workflow would stop. By adding this
28+
# condition you can continue the execution with the populated error message.
29+
if: always() && (steps.lint_pr_title.outputs.error_message != null)
30+
with:
31+
header: pr-title-lint-error
32+
message: |
33+
Hey there and thank you for opening this pull request! 👋🏼
34+
35+
We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted.
36+
37+
Details:
38+
39+
```
40+
${{ steps.lint_pr_title.outputs.error_message }}
41+
```
42+
43+
# Delete a previous comment when the issue has been resolved
44+
- if: ${{ steps.lint_pr_title.outputs.error_message == null }}
45+
uses: marocchino/sticky-pull-request-comment@v2
46+
with:
47+
header: pr-title-lint-error
48+
delete: true

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ node_modules/
99
.circleci/processed-config.yml
1010

1111
.DS_Store
12+
13+
/.idea

.rubocop.yml

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@ require: rubocop-rspec
33
AllCops:
44
TargetRubyVersion: 2.3
55
DisplayCopNames: true
6+
NewCops: disable
67
Exclude:
78
- 'node_modules/**/*'
89
- 'gemfiles/**/*'
910
- 'vendor/**/*'
1011
- lib/apollo-federation/tracing/proto/apollo_pb.rb
1112

13+
Gemspec/DevelopmentDependencies:
14+
Enabled: false
1215
#
1316
# We prefer trailing commas so that the git diff is reduced when adding elements
1417
#
@@ -21,8 +24,6 @@ Style/TrailingCommaInArrayLiteral:
2124
Style/TrailingCommaInHashLiteral:
2225
Enabled: true
2326
EnforcedStyleForMultiline: consistent_comma
24-
Style/BracesAroundHashParameters:
25-
EnforcedStyle: context_dependent
2627
Style/ConditionalAssignment:
2728
EnforcedStyle: assign_inside_condition
2829
IncludeTernaryExpressions: false
@@ -38,7 +39,12 @@ Style/NegatedIf:
3839
Enabled: false
3940
Style/Documentation:
4041
Enabled: false
41-
42+
Style/HashAsLastArrayItem:
43+
Enabled: false
44+
Naming/VariableNumber:
45+
Enabled: false
46+
Lint/ConstantDefinitionInBlock:
47+
Enabled: false
4248
Metrics/AbcSize:
4349
Enabled: false
4450
Metrics/BlockLength:
@@ -50,11 +56,10 @@ Metrics/ModuleLength:
5056
Metrics/ParameterLists:
5157
Max: 5
5258
CountKeywordArgs: false
53-
Metrics/LineLength:
59+
Layout/LineLength:
5460
Max: 120
5561
Exclude:
5662
- lib/apollo-federation/tracing/proto/apollo_pb.rb
57-
5863
Naming/FileName:
5964
Exclude:
6065
- 'lib/apollo-federation.rb'
@@ -64,10 +69,21 @@ RSpec/ExampleLength:
6469
Enabled: false
6570
RSpec/NestedGroups:
6671
Enabled: false
67-
RSpec/FilePath:
72+
RSpec/SpecFilePathFormat:
6873
CustomTransform:
6974
ApolloFederation: apollo-federation
70-
75+
RSpec/RepeatedExampleGroupDescription:
76+
Enabled: false
77+
RSpec/LeakyConstantDeclaration:
78+
Enabled: false
79+
RSpec/MultipleMemoizedHelpers:
80+
Enabled: false
81+
RSpec/IndexedLet:
82+
Enabled: false
83+
RSpec/EmptyLineAfterExample:
84+
Enabled: false
85+
RSpec/MatchArray:
86+
Enabled: false
7187
# Disabled so we can support Ruby 2.2
7288
# Rubocop only supports >= 2.3
7389
Gemspec/RequiredRubyVersion:

.stignore

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
*.gem
2+
*.rbc
3+
.idea
4+
coverage
5+
InstalledFiles
6+
pkg
7+
spec/reports
8+
spec/examples.txt
9+
test/tmp
10+
test/version_tmp
11+
tmp
12+
13+
# Ignore Byebug command history file.
14+
.byebug_history
15+
16+
## Specific to RubyMotion:
17+
.dat*
18+
.repl_history
19+
build
20+
*.bridgesupport
21+
build-iPhoneOS
22+
build-iPhoneSimulator
23+
24+
## Specific to RubyMotion (use of CocoaPods):
25+
#
26+
# We recommend against adding the Pods directory to your .gitignore. However
27+
# you should judge for yourself, the pros and cons are mentioned at:
28+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
29+
#
30+
# vendor/Pods/
31+
32+
## Documentation cache and generated files:
33+
.yardoc
34+
_yardoc
35+
36+
## Environment normalization:
37+
vendor/bundle
38+
lib/bundler/man
39+
40+
# for a library or gem, you might want to ignore these files since the code is
41+
# intended to run in multiple environments; otherwise, check them in:
42+
Gemfile.lock
43+
.ruby-version
44+
.ruby-gemset
45+
46+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
47+
.rvmrc

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
# [3.10.0](https://github.com/mondaycom/apollo-federation-ruby/compare/v3.9.0...v3.10.0) (2024-11-21)
2+
3+
4+
### Features
5+
6+
* add support for [@compose](https://github.com/compose)Directive ([#3](https://github.com/mondaycom/apollo-federation-ruby/issues/3)) ([6d7ccf2](https://github.com/mondaycom/apollo-federation-ruby/commit/6d7ccf2e98ead837847ab1b16b44b3b68adbfe84))
7+
8+
# [3.9.0](https://github.com/mondaycom/apollo-federation-ruby/compare/v3.8.5...v3.9.0) (2024-11-20)
9+
10+
11+
### Features
12+
13+
* update google-protobuf ([#291](https://github.com/Gusto/apollo-federation-ruby/issues/291)) ([2deda45](https://github.com/Gusto/apollo-federation-ruby/commit/2deda45fd37b6e7e9749a0be43b83def6963b8b6))
14+
15+
# [3.9.0](https://github.com/Gusto/apollo-federation-ruby/compare/v3.8.5...v3.9.0) (2025-02-05)
16+
17+
18+
### Features
19+
20+
* drop old ruby; remove appraisals ([#290](https://github.com/Gusto/apollo-federation-ruby/issues/290)) ([9caa715](https://github.com/Gusto/apollo-federation-ruby/commit/9caa7159b16cf813b23bc067ef2d2b33b06501a2))
21+
122
# [3.10.0](https://github.com/Gusto/apollo-federation-ruby/compare/v3.9.0...v3.10.0) (2025-02-05)
223

324

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ source 'https://rubygems.org'
44

55
gemspec
66

7+
gem 'appraisal', '~> 2.5.0'
78
gem 'graphql', '~> 2.0.0'

Gemfile.lock

Lines changed: 26 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ PATH
33
specs:
44
apollo-federation (3.10.0)
55
google-protobuf (< 5)
6-
graphql
6+
graphql (>= 1.10.14)
77

88
GEM
99
remote: https://rubygems.org/
@@ -26,39 +26,28 @@ GEM
2626
i18n (>= 1.6, < 2)
2727
minitest (>= 5.1)
2828
tzinfo (~> 2.0)
29+
appraisal (2.5.0)
30+
bundler
31+
rake
32+
thor (>= 0.14.0)
2933
ast (2.4.2)
3034
base64 (0.2.0)
31-
bigdecimal (3.1.9)
3235
builder (3.2.4)
3336
byebug (11.1.3)
3437
coderay (1.1.3)
3538
concurrent-ruby (1.2.2)
3639
crass (1.0.6)
37-
date (3.4.1)
38-
debug (1.10.0)
39-
irb (~> 1.10)
40-
reline (>= 0.3.8)
4140
diff-lcs (1.5.0)
4241
erubi (1.12.0)
43-
google-protobuf (4.29.3-arm64-darwin)
44-
bigdecimal
45-
rake (>= 13)
46-
google-protobuf (4.29.3-x86_64-darwin)
47-
bigdecimal
48-
rake (>= 13)
49-
google-protobuf (4.29.3-x86_64-linux)
50-
bigdecimal
51-
rake (>= 13)
42+
google-protobuf (3.25.6-arm64-darwin)
43+
google-protobuf (3.25.6-x86_64-darwin)
44+
google-protobuf (3.25.6-x86_64-linux)
5245
graphql (2.0.31)
5346
base64
5447
i18n (1.12.0)
5548
concurrent-ruby (~> 1.0)
56-
io-console (0.8.0)
57-
irb (1.15.1)
58-
pp (>= 0.6.0)
59-
rdoc (>= 4.0.0)
60-
reline (>= 0.4.2)
61-
jaro_winkler (1.5.6)
49+
json (2.10.1)
50+
language_server-protocol (3.17.0.4)
6251
loofah (2.19.1)
6352
crass (~> 1.0.2)
6453
nokogiri (>= 1.5.9)
@@ -73,20 +62,15 @@ GEM
7362
racc (~> 1.4)
7463
ostruct (0.6.1)
7564
parallel (1.22.1)
76-
parser (3.2.1.1)
65+
parser (3.3.7.1)
7766
ast (~> 2.4.1)
78-
pp (0.6.2)
79-
prettyprint
80-
prettyprint (0.2.0)
67+
racc
8168
pry (0.14.2)
8269
coderay (~> 1.1)
8370
method_source (~> 1.0)
8471
pry-byebug (3.10.1)
8572
byebug (~> 11.0)
8673
pry (>= 0.13, < 0.15)
87-
psych (5.2.3)
88-
date
89-
stringio
9074
racc (1.6.2)
9175
rack (2.2.6.4)
9276
rack-test (2.1.0)
@@ -101,10 +85,7 @@ GEM
10185
loofah (~> 2.19, >= 2.19.1)
10286
rainbow (3.1.1)
10387
rake (13.0.6)
104-
rdoc (6.11.0)
105-
psych (>= 4.0.0)
106-
reline (0.6.0)
107-
io-console (~> 0.5)
88+
regexp_parser (2.10.0)
10889
rspec (3.12.0)
10990
rspec-core (~> 3.12.0)
11091
rspec-expectations (~> 3.12.0)
@@ -118,20 +99,25 @@ GEM
11899
diff-lcs (>= 1.2.0, < 2.0)
119100
rspec-support (~> 3.12.0)
120101
rspec-support (3.12.0)
121-
rubocop (0.75.1)
122-
jaro_winkler (~> 1.5.1)
102+
rubocop (1.68.0)
103+
json (~> 2.3)
104+
language_server-protocol (>= 3.17.0)
123105
parallel (~> 1.10)
124-
parser (>= 2.6)
106+
parser (>= 3.3.0.2)
125107
rainbow (>= 2.2.2, < 4.0)
108+
regexp_parser (>= 2.4, < 3.0)
109+
rubocop-ast (>= 1.32.2, < 2.0)
126110
ruby-progressbar (~> 1.7)
127-
unicode-display_width (>= 1.4.0, < 1.7)
111+
unicode-display_width (>= 2.4.0, < 3.0)
112+
rubocop-ast (1.38.1)
113+
parser (>= 3.3.1.0)
128114
rubocop-rspec (1.33.0)
129115
rubocop (>= 0.60.0)
130116
ruby-progressbar (1.13.0)
131-
stringio (3.1.2)
117+
thor (1.3.2)
132118
tzinfo (2.0.6)
133119
concurrent-ruby (~> 1.0)
134-
unicode-display_width (1.6.1)
120+
unicode-display_width (2.6.0)
135121
webrick (1.8.1)
136122

137123
PLATFORMS
@@ -146,7 +132,7 @@ PLATFORMS
146132
DEPENDENCIES
147133
actionpack
148134
apollo-federation!
149-
debug
135+
appraisal (~> 2.5.0)
150136
graphql (~> 2.0.0)
151137
mutex_m
152138
ostruct
@@ -155,7 +141,7 @@ DEPENDENCIES
155141
rackup
156142
rake
157143
rspec
158-
rubocop (~> 0.75.0)
144+
rubocop (~> 1.68.0)
159145
rubocop-rspec
160146
webrick
161147

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,20 @@ class User < BaseObject
302302
end
303303
```
304304

305+
### The `@policy` directive (Apollo Federation v2)
306+
307+
[Apollo documentation](https://www.apollographql.com/docs/federation/federated-types/federated-directives/#policy)
308+
309+
Call `policy` within your class definition or pass the `policy:` option to your field definition:
310+
311+
```ruby
312+
class Product < BaseObject
313+
policy policies: [["stock:read"]]
314+
field :id, ID, null: false
315+
field :inStock, Boolean, null: false, policy: { policies: [["stock:read"]] }
316+
end
317+
```
318+
305319
### Field set syntax
306320

307321
Field sets can be either strings encoded with the Apollo Field Set [syntax]((https://www.apollographql.com/docs/apollo-server/federation/federation-spec/#scalar-_fieldset)) or arrays, hashes and snake case symbols that follow the graphql-ruby conventions:

apollo-federation.gemspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,18 @@ Gem::Specification.new do |spec|
2626

2727
spec.files = `git ls-files bin lib *.md LICENSE`.split("\n")
2828

29-
spec.add_dependency 'graphql'
29+
spec.add_dependency 'graphql', '>= 1.10.14'
3030

3131
spec.add_runtime_dependency 'google-protobuf', '< 5'
3232

3333
spec.add_development_dependency 'actionpack'
34-
spec.add_development_dependency 'debug'
34+
spec.add_development_dependency 'appraisal'
3535
spec.add_development_dependency 'pry-byebug'
3636
spec.add_development_dependency 'rack'
3737
spec.add_development_dependency 'rackup'
3838
spec.add_development_dependency 'rake'
3939
spec.add_development_dependency 'rspec'
40-
spec.add_development_dependency 'rubocop', '~> 0.75.0'
40+
spec.add_development_dependency 'rubocop', '~> 1.68.0'
4141
spec.add_development_dependency 'rubocop-rspec'
4242
spec.add_development_dependency 'webrick'
4343

0 commit comments

Comments
 (0)