open_api_annotator 0.6.0 → 0.6.2

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: 928d9daca39028c7d5016fa2e44ca116891194210ebaee873e325240bff2a428
4
- data.tar.gz: f40479f6b544ccef964c611acf974763bc205b623682b6114d66707253638b75
3
+ metadata.gz: a53663269a69d9eca0b1148da5698071fcfeba3d2457f4614c3e76303bb28aa9
4
+ data.tar.gz: 3c1db3245019f65a0f1936cb47911c717cf9b1a024d362c2ea916621dca78418
5
5
  SHA512:
6
- metadata.gz: 7bfb5f922e2b92ef554b3b2d042a108471a4fe666fd69ed9c242eeae1e48b1105af7dc30caafd8d7be64babeb478990918136563b1deedf1d3f18099addfd098
7
- data.tar.gz: 7198242aec1d0c81b3e47e0ba44bcbbbfea679673f9bdf31de31c753b45aff536e4c15f46cd26b854220fbe249c82b3aa46d1a78f8b2cdc86920f26a36cdbfe2
6
+ metadata.gz: 24b7421c28a82949a4e89fa68c1f5e12e97d48d19c8f0a45e104405af6b7636a0f5cb9fed57f1f01dbff7afbe3e5a9a714f743a90e8898ca42f285479de6d1d8
7
+ data.tar.gz: d686bed20207c8c59b89b5481aa9c2dad353d4a04b537da660e72246e27b362c72ab550a5b1fa8cffe82446d50e34c3f4577b6fe2db888197a1f9ff27581e25c
@@ -4,26 +4,28 @@ jobs:
4
4
  test:
5
5
  strategy:
6
6
  matrix:
7
- ruby: ["2.5", "2.6", "2.7", "3.0"]
7
+ ruby: ["3.3", "3.4", "4.0"]
8
8
  gemfile: [Gemfile]
9
9
  include:
10
- - ruby: "2.7"
11
- gemfile: "gemfiles/rails-6.0.gemfile"
12
- - ruby: "2.6"
13
- gemfile: "gemfiles/rails-5.2.gemfile"
10
+ - ruby: "3.3"
11
+ gemfile: "gemfiles/rails-8.0.gemfile"
12
+ - ruby: "3.3"
13
+ gemfile: "gemfiles/rails-7.2.gemfile"
14
+ - ruby: "3.3"
15
+ gemfile: "gemfiles/rails-7.1.gemfile"
16
+ - ruby: "3.3"
17
+ gemfile: "gemfiles/rails-7.0.gemfile"
18
+ - ruby: "4.0"
19
+ gemfile: "gemfiles/rails-7.0.gemfile"
14
20
 
15
21
  env:
16
22
  BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
17
23
 
18
24
  runs-on: ubuntu-latest
19
25
  steps:
20
- - uses: actions/checkout@v2
26
+ - uses: actions/checkout@v4
21
27
  - uses: ruby/setup-ruby@v1
22
28
  with:
23
29
  ruby-version: ${{ matrix.ruby }}
24
30
  bundler-cache: true
25
31
  - run: bundle exec rake
26
- - name: Send coverage
27
- uses: paambaati/codeclimate-action@v2.7.5
28
- env:
29
- CC_TEST_REPORTER_ID: 921d046db793707b7d0c0d1305970a137fdf98fbc6ceeb6c355c44757040244f
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.0.2
1
+ 4.0.9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  ## Not released yet
2
2
 
3
+ ## 0.6.2
4
+
5
+ - Fix `rake api_spec` raising `NoMethodError` on Rails 7.0 or later https://github.com/wantedly/open_api_annotator/pull/20
6
+ - Fix `$ref` of `belongs_to` with `serializer:` option being an array like `#/components/schemas/["User"]` https://github.com/wantedly/open_api_annotator/pull/20
7
+ - Skip `has_many` annotated with a non-array type (e.g. `type: User`) or an empty array with a warning, instead of raising an error or emitting a broken `$ref` https://github.com/wantedly/open_api_annotator/pull/20
8
+ - Require open_api >= 0.6.3 https://github.com/wantedly/open_api_annotator/pull/20
9
+ - Bump Ruby and Rails https://github.com/wantedly/open_api_annotator/pull/20
10
+ - Supported Rubies: 3.3, 3.4, 4.0
11
+ - Supported Rails: 7.0, 7.1, 7.2, 8.0, 8.1
12
+
13
+ ## 0.6.1
14
+
15
+ - Reflect ownership transfer https://github.com/wantedly/open_api_annotator/pull/18
16
+ - Bump Ruby and Rails https://github.com/wantedly/open_api_annotator/pull/19
17
+ - Supported Rubies: 3.0, 3.1, 3.2
18
+ - Supported Rails: 6.1, 7.0, 7.1
19
+
3
20
  ## 0.6.0
4
21
  - Support Ruby 3.0 and Rails 6.1
5
22
  ## 0.5.0
data/CODE_OF_CONDUCT.md CHANGED
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
55
55
  ## Enforcement
56
56
 
57
57
  Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at ngtknt@me.com. All
58
+ reported by contacting the project team at dev@wantedly.com. All
59
59
  complaints will be reviewed and investigated and will result in a response that
60
60
  is deemed necessary and appropriate to the circumstances. The project team is
61
61
  obligated to maintain confidentiality with regard to the reporter of an incident.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # OpenApiAnnotator [![Gem Version](https://badge.fury.io/rb/open_api_annotator.svg)](https://badge.fury.io/rb/open_api_annotator) [![Build Status](https://travis-ci.org/ngtk/open_api_annotator.svg?branch=master)](https://travis-ci.org/ngtk/open_api_annotator) [![Maintainability](https://api.codeclimate.com/v1/badges/8be7a273496459c62190/maintainability)](https://codeclimate.com/github/ngtk/open_api_annotator/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/8be7a273496459c62190/test_coverage)](https://codeclimate.com/github/ngtk/open_api_annotator/test_coverage)
1
+ # OpenApiAnnotator [![Gem Version](https://badge.fury.io/rb/open_api_annotator.svg)](https://badge.fury.io/rb/open_api_annotator) [![Build Status](https://travis-ci.org/wantedly/open_api_annotator.svg?branch=master)](https://travis-ci.org/wantedly/open_api_annotator)
2
2
 
3
3
  OpenApiAnnotator realizes to generate OpenAPI spec by annotating to controllers and serializers.
4
4
  If you use ActiveModelSerializer, this is the best way to generate OpenAPI spec.
@@ -80,7 +80,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
80
80
 
81
81
  ## Contributing
82
82
 
83
- Bug reports and pull requests are welcome on GitHub at https://github.com/ngtk/open_api_annotator. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
83
+ Bug reports and pull requests are welcome on GitHub at https://github.com/wantedly/open_api_annotator. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
84
84
 
85
85
  ## License
86
86
 
@@ -88,4 +88,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
88
88
 
89
89
  ## Code of Conduct
90
90
 
91
- Everyone interacting in the OpenApiAnnotator project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/ngtk/open_api_annotator/blob/master/CODE_OF_CONDUCT.md).
91
+ Everyone interacting in the OpenApiAnnotator project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/wantedly/open_api_annotator/blob/master/CODE_OF_CONDUCT.md).
@@ -5,4 +5,4 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
5
5
  # Specify your gem's dependencies in open_api_annotator.gemspec
6
6
  gemspec path: '..'
7
7
 
8
- gem 'railties', '~> 5.2.0'
8
+ gem 'railties', '~> 7.0.0'
@@ -5,4 +5,4 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
5
5
  # Specify your gem's dependencies in open_api_annotator.gemspec
6
6
  gemspec path: '..'
7
7
 
8
- gem 'railties', '~> 6.0.0'
8
+ gem 'railties', '~> 7.1.0'
@@ -0,0 +1,8 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in open_api_annotator.gemspec
6
+ gemspec path: '..'
7
+
8
+ gem 'railties', '~> 7.2.0'
@@ -0,0 +1,8 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in open_api_annotator.gemspec
6
+ gemspec path: '..'
7
+
8
+ gem 'railties', '~> 8.0.0'
@@ -56,8 +56,12 @@ module OpenApiAnnotator
56
56
  properties = {}
57
57
  serializer.open_api_has_many_associations.each do |association|
58
58
  next unless association.valid?
59
- content = association.type.first
60
- return unless content
59
+ # Calling `first` on a non-array type (e.g. an ActiveRecord model) would run a query
60
+ content = association.type.first if association.type.is_a?(Array)
61
+ unless content
62
+ warn "Skipped #{serializer.name}##{association.name}: type of has_many should be an array with one element, but got #{association.type}."
63
+ next
64
+ end
61
65
  content_name = content.try(:name) || content.to_s
62
66
  properties[association.name.to_sym] = OpenApi::Schema.new(
63
67
  type: "array",
@@ -140,7 +140,7 @@ module OpenApiAnnotator
140
140
  def find_all
141
141
  @routes ||= Rails.application.routes.routes.routes.map do |route|
142
142
  parameters = []
143
- path = PathResolver.new.resolve(route.path.ast, parameters)
143
+ path = PathResolver.new.resolve(route.path.spec, parameters)
144
144
  controller = route.requirements[:controller]
145
145
  action = route.requirements[:action]
146
146
  Route.new(http_verb: route.verb, path: path, controller_name: controller, action_name: action, parameters: parameters)
@@ -77,7 +77,7 @@ module OpenApiAnnotator
77
77
  reflection.is_a?(ActiveModel::Serializer::BelongsToReflection)
78
78
  }.map do |reflection|
79
79
  serializer_class = reflection.options[:serializer]
80
- type = serializer_class ? [serializer_class.open_api_resource_name] : reflection.options[:type]
80
+ type = serializer_class ? serializer_class.open_api_resource_name : reflection.options[:type]
81
81
  Association.new(reflection.name.to_sym, type, reflection.options[:nullable])
82
82
  end
83
83
  end
@@ -1,3 +1,3 @@
1
1
  module OpenApiAnnotator
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.2"
3
3
  end
@@ -6,12 +6,12 @@ require "open_api_annotator/version"
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "open_api_annotator"
8
8
  spec.version = OpenApiAnnotator::VERSION
9
- spec.authors = ["Kent Nagata"]
10
- spec.email = ["ngtknt@me.com"]
9
+ spec.authors = ["Kent Nagata", "Wantedly, Inc."]
10
+ spec.email = ["ngtknt@me.com", "dev@wantedly.com"]
11
11
 
12
12
  spec.summary = %q{OpenApi spec generation by bottom-up.}
13
13
  spec.description = %q{OpenApiAnnotator realizes to generate OpenApi spec by annotating to Controller and ActiveModelSerializer.}
14
- spec.homepage = "https://github.com/ngtk/open_api_annotator"
14
+ spec.homepage = "https://github.com/wantedly/open_api_annotator"
15
15
  spec.license = "MIT"
16
16
 
17
17
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
@@ -21,14 +21,13 @@ Gem::Specification.new do |spec|
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
22
  spec.require_paths = ["lib"]
23
23
 
24
- spec.add_dependency "open_api", ">= 0.5.0"
24
+ spec.add_dependency "open_api", ">= 0.6.3"
25
25
  spec.add_dependency "active_model_serializers", "~> 0.10.0"
26
26
 
27
- rails_versions = ['>= 5.0', '< 6.2']
27
+ rails_versions = ['>= 5.0', '< 8.2']
28
28
  spec.add_dependency "actionpack", rails_versions
29
29
  spec.add_dependency "railties", rails_versions
30
30
 
31
- spec.add_development_dependency "bundler", "~> 2.0"
32
31
  spec.add_development_dependency "rake", "~> 13.0"
33
32
  spec.add_development_dependency "rspec", "~> 3.0"
34
33
  spec.add_development_dependency "pry"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: open_api_annotator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kent Nagata
8
- autorequire:
8
+ - Wantedly, Inc.
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-10 00:00:00.000000000 Z
11
+ date: 1980-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: open_api
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.5.0
19
+ version: 0.6.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.5.0
26
+ version: 0.6.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: active_model_serializers
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -47,7 +47,7 @@ dependencies:
47
47
  version: '5.0'
48
48
  - - "<"
49
49
  - !ruby/object:Gem::Version
50
- version: '6.2'
50
+ version: '8.2'
51
51
  type: :runtime
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
@@ -57,7 +57,7 @@ dependencies:
57
57
  version: '5.0'
58
58
  - - "<"
59
59
  - !ruby/object:Gem::Version
60
- version: '6.2'
60
+ version: '8.2'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: railties
63
63
  requirement: !ruby/object:Gem::Requirement
@@ -67,7 +67,7 @@ dependencies:
67
67
  version: '5.0'
68
68
  - - "<"
69
69
  - !ruby/object:Gem::Version
70
- version: '6.2'
70
+ version: '8.2'
71
71
  type: :runtime
72
72
  prerelease: false
73
73
  version_requirements: !ruby/object:Gem::Requirement
@@ -77,21 +77,7 @@ dependencies:
77
77
  version: '5.0'
78
78
  - - "<"
79
79
  - !ruby/object:Gem::Version
80
- version: '6.2'
81
- - !ruby/object:Gem::Dependency
82
- name: bundler
83
- requirement: !ruby/object:Gem::Requirement
84
- requirements:
85
- - - "~>"
86
- - !ruby/object:Gem::Version
87
- version: '2.0'
88
- type: :development
89
- prerelease: false
90
- version_requirements: !ruby/object:Gem::Requirement
91
- requirements:
92
- - - "~>"
93
- - !ruby/object:Gem::Version
94
- version: '2.0'
80
+ version: '8.2'
95
81
  - !ruby/object:Gem::Dependency
96
82
  name: rake
97
83
  requirement: !ruby/object:Gem::Requirement
@@ -166,6 +152,7 @@ description: OpenApiAnnotator realizes to generate OpenApi spec by annotating to
166
152
  and ActiveModelSerializer.
167
153
  email:
168
154
  - ngtknt@me.com
155
+ - dev@wantedly.com
169
156
  executables: []
170
157
  extensions: []
171
158
  extra_rdoc_files: []
@@ -182,8 +169,10 @@ files:
182
169
  - Rakefile
183
170
  - bin/console
184
171
  - bin/setup
185
- - gemfiles/rails-5.2.gemfile
186
- - gemfiles/rails-6.0.gemfile
172
+ - gemfiles/rails-7.0.gemfile
173
+ - gemfiles/rails-7.1.gemfile
174
+ - gemfiles/rails-7.2.gemfile
175
+ - gemfiles/rails-8.0.gemfile
187
176
  - lib/open_api_annotator.rb
188
177
  - lib/open_api_annotator/association.rb
189
178
  - lib/open_api_annotator/attribute.rb
@@ -203,11 +192,10 @@ files:
203
192
  - lib/open_api_annotator/version.rb
204
193
  - lib/tasks/api_spec.rake
205
194
  - open_api_annotator.gemspec
206
- homepage: https://github.com/ngtk/open_api_annotator
195
+ homepage: https://github.com/wantedly/open_api_annotator
207
196
  licenses:
208
197
  - MIT
209
198
  metadata: {}
210
- post_install_message:
211
199
  rdoc_options: []
212
200
  require_paths:
213
201
  - lib
@@ -222,8 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
210
  - !ruby/object:Gem::Version
223
211
  version: '0'
224
212
  requirements: []
225
- rubygems_version: 3.2.24
226
- signing_key:
213
+ rubygems_version: 4.0.20
227
214
  specification_version: 4
228
215
  summary: OpenApi spec generation by bottom-up.
229
216
  test_files: []