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 +4 -4
- data/.github/workflows/test.yml +12 -10
- data/.ruby-version +1 -1
- data/CHANGELOG.md +17 -0
- data/CODE_OF_CONDUCT.md +1 -1
- data/README.md +3 -3
- data/gemfiles/{rails-5.2.gemfile → rails-7.0.gemfile} +1 -1
- data/gemfiles/{rails-6.0.gemfile → rails-7.1.gemfile} +1 -1
- data/gemfiles/rails-7.2.gemfile +8 -0
- data/gemfiles/rails-8.0.gemfile +8 -0
- data/lib/open_api_annotator/components_builder.rb +6 -2
- data/lib/open_api_annotator/paths_builder.rb +1 -1
- data/lib/open_api_annotator/serializer_annotatable.rb +1 -1
- data/lib/open_api_annotator/version.rb +1 -1
- data/open_api_annotator.gemspec +5 -6
- metadata +16 -29
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a53663269a69d9eca0b1148da5698071fcfeba3d2457f4614c3e76303bb28aa9
|
|
4
|
+
data.tar.gz: 3c1db3245019f65a0f1936cb47911c717cf9b1a024d362c2ea916621dca78418
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 24b7421c28a82949a4e89fa68c1f5e12e97d48d19c8f0a45e104405af6b7636a0f5cb9fed57f1f01dbff7afbe3e5a9a714f743a90e8898ca42f285479de6d1d8
|
|
7
|
+
data.tar.gz: d686bed20207c8c59b89b5481aa9c2dad353d4a04b537da660e72246e27b362c72ab550a5b1fa8cffe82446d50e34c3f4577b6fe2db888197a1f9ff27581e25c
|
data/.github/workflows/test.yml
CHANGED
|
@@ -4,26 +4,28 @@ jobs:
|
|
|
4
4
|
test:
|
|
5
5
|
strategy:
|
|
6
6
|
matrix:
|
|
7
|
-
ruby: ["
|
|
7
|
+
ruby: ["3.3", "3.4", "4.0"]
|
|
8
8
|
gemfile: [Gemfile]
|
|
9
9
|
include:
|
|
10
|
-
- ruby: "
|
|
11
|
-
gemfile: "gemfiles/rails-
|
|
12
|
-
- ruby: "
|
|
13
|
-
gemfile: "gemfiles/rails-
|
|
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@
|
|
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
|
-
|
|
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
|
|
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 [](https://badge.fury.io/rb/open_api_annotator) [](https://badge.fury.io/rb/open_api_annotator) [](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/
|
|
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/
|
|
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).
|
|
@@ -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
|
-
|
|
60
|
-
|
|
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.
|
|
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 ?
|
|
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
|
data/open_api_annotator.gemspec
CHANGED
|
@@ -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/
|
|
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.
|
|
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', '<
|
|
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.
|
|
4
|
+
version: 0.6.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kent Nagata
|
|
8
|
-
|
|
8
|
+
- Wantedly, Inc.
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
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.
|
|
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.
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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-
|
|
186
|
-
- gemfiles/rails-
|
|
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/
|
|
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:
|
|
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: []
|