r2-oas 0.3.0 → 0.3.1
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/.rubocop_todo.yml +10 -1
- data/CHANGELOG.md +6 -0
- data/GEMSPEC.md +2 -1
- data/lib/r2-oas.rb +2 -4
- data/lib/r2-oas/lib/core_ext/hash/deep_merge.rb +44 -0
- data/lib/r2-oas/lib/core_ext/object/blank.rb +135 -0
- data/lib/r2-oas/version.rb +1 -1
- data/r2-oas.gemspec +2 -1
- metadata +30 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 202a93f6e116bb378c723a0810746749dea8059e91d2c199727739850ca528e7
|
4
|
+
data.tar.gz: 8061d7a71e56c7656065b20ac85f39755df665dd0d22031e01374e82a773114c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0700ad89a7147febd6b7fabb6c2343403a0f0fc4fa2e244996e3a2fa24a9e951e6e5899335f4fb4e26858796c87b04e4af4984992ce06d3a0d6864fdd6f2659f
|
7
|
+
data.tar.gz: 2bab390d140d5eeef3b12b7563ffe20e3b2179e129f38bf4c3c4483777d80f4b91e5f73f8d74ad7a8f7c9db81ff258915a6a57cda90b4b2edcf199eb26b2ec49
|
data/.rubocop_todo.yml
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
# Cop supports --auto-correct.
|
11
11
|
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
12
12
|
# URISchemes: http, https
|
13
|
-
|
13
|
+
Layout/LineLength:
|
14
14
|
Max: 2088
|
15
15
|
|
16
16
|
Metrics/AbcSize:
|
@@ -280,3 +280,12 @@ Style/SlicingWithRange:
|
|
280
280
|
Lint/NonDeterministicRequireOrder:
|
281
281
|
Exclude:
|
282
282
|
- "spec/spec_helper.rb"
|
283
|
+
|
284
|
+
Lint/MixedRegexpCaptureTypes:
|
285
|
+
Enabled: false
|
286
|
+
|
287
|
+
Style/RedundantRegexpCharacterClass:
|
288
|
+
Enabled: false
|
289
|
+
|
290
|
+
Style/RedundantRegexpEscape:
|
291
|
+
Enabled: false
|
data/CHANGELOG.md
CHANGED
data/GEMSPEC.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
Configureless and no DSL. 👍 But you can also configure.
|
2
|
+
Manage with yaml file instead of Ruby code.
|
2
3
|
Loosely coupled to your Rails project. 👍
|
3
|
-
So
|
4
|
+
So if you want to use another tool, you can port it right away. 😢
|
4
5
|
Generate api docment(OpenAPI) side only from `Rails` routing.
|
5
6
|
|
6
7
|
Provide rake tasks to management API Docment (OpenAPI) 🎉
|
data/lib/r2-oas.rb
CHANGED
@@ -6,14 +6,14 @@ require 'r2-oas/errors'
|
|
6
6
|
require 'r2-oas/schema/v3/object/public'
|
7
7
|
|
8
8
|
module R2OAS
|
9
|
-
extend ActiveSupport::Autoload
|
10
|
-
|
11
9
|
if !defined?(::Rails)
|
12
10
|
raise NoImplementError, 'Can not load Rails'
|
13
11
|
# support Rails version
|
14
12
|
elsif ::Rails::VERSION::STRING >= '4.2.5.1'
|
15
13
|
extend Configuration
|
16
14
|
require 'r2-oas/task'
|
15
|
+
require 'r2-oas/lib/core_ext/hash/deep_merge'
|
16
|
+
require 'r2-oas/lib/core_ext/object/blank'
|
17
17
|
|
18
18
|
autoload :Base, 'r2-oas/base'
|
19
19
|
autoload :NoImplementError, 'r2-oas/errors'
|
@@ -22,8 +22,6 @@ module R2OAS
|
|
22
22
|
autoload :Sortable, 'r2-oas/shared/all'
|
23
23
|
|
24
24
|
module Schema
|
25
|
-
extend ActiveSupport::Autoload
|
26
|
-
|
27
25
|
autoload :Base, 'r2-oas/schema/base'
|
28
26
|
autoload :Generator, 'r2-oas/schema/generator'
|
29
27
|
autoload :Builder, 'r2-oas/schema/builder'
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copy From https://github.com/rails/rails/blob/v4.2.5/activesupport/lib/active_support/core_ext/hash/deep_merge.rb
|
4
|
+
|
5
|
+
# rubocop:disable all
|
6
|
+
class Hash
|
7
|
+
# Returns a new hash with +self+ and +other_hash+ merged recursively.
|
8
|
+
#
|
9
|
+
# h1 = { a: true, b: { c: [1, 2, 3] } }
|
10
|
+
# h2 = { a: false, b: { x: [3, 4, 5] } }
|
11
|
+
#
|
12
|
+
# h1.deep_merge(h2) #=> { a: false, b: { c: [1, 2, 3], x: [3, 4, 5] } }
|
13
|
+
#
|
14
|
+
# Like with Hash#merge in the standard library, a block can be provided
|
15
|
+
# to merge values:
|
16
|
+
#
|
17
|
+
# h1 = { a: 100, b: 200, c: { c1: 100 } }
|
18
|
+
# h2 = { b: 250, c: { c1: 200 } }
|
19
|
+
# h1.deep_merge(h2) { |key, this_val, other_val| this_val + other_val }
|
20
|
+
# # => { a: 100, b: 450, c: { c1: 300 } }
|
21
|
+
def deep_merge(other_hash, &block)
|
22
|
+
dup.deep_merge!(other_hash, &block)
|
23
|
+
end
|
24
|
+
|
25
|
+
# Same as +deep_merge+, but modifies +self+.
|
26
|
+
def deep_merge!(other_hash, &block)
|
27
|
+
other_hash.each_pair do |current_key, other_value|
|
28
|
+
this_value = self[current_key]
|
29
|
+
|
30
|
+
self[current_key] = if this_value.is_a?(Hash) && other_value.is_a?(Hash)
|
31
|
+
this_value.deep_merge(other_value, &block)
|
32
|
+
else
|
33
|
+
if block_given? && key?(current_key)
|
34
|
+
block.call(current_key, this_value, other_value)
|
35
|
+
else
|
36
|
+
other_value
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
self
|
42
|
+
end
|
43
|
+
end
|
44
|
+
# rubocop:enable all
|
@@ -0,0 +1,135 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copy From https://github.com/rails/rails/blob/v4.2.5/activesupport/lib/active_support/core_ext/object/blank.rb
|
4
|
+
|
5
|
+
# rubocop:disable all
|
6
|
+
class Object
|
7
|
+
# An object is blank if it's false, empty, or a whitespace string.
|
8
|
+
# For example, +false+, '', ' ', +nil+, [], and {} are all blank.
|
9
|
+
#
|
10
|
+
# This simplifies
|
11
|
+
#
|
12
|
+
# !address || address.empty?
|
13
|
+
#
|
14
|
+
# to
|
15
|
+
#
|
16
|
+
# address.blank?
|
17
|
+
#
|
18
|
+
# @return [true, false]
|
19
|
+
def blank?
|
20
|
+
respond_to?(:empty?) ? !!empty? : !self
|
21
|
+
end
|
22
|
+
|
23
|
+
# An object is present if it's not blank.
|
24
|
+
#
|
25
|
+
# @return [true, false]
|
26
|
+
def present?
|
27
|
+
!blank?
|
28
|
+
end
|
29
|
+
|
30
|
+
# Returns the receiver if it's present otherwise returns +nil+.
|
31
|
+
# <tt>object.presence</tt> is equivalent to
|
32
|
+
#
|
33
|
+
# object.present? ? object : nil
|
34
|
+
#
|
35
|
+
# For example, something like
|
36
|
+
#
|
37
|
+
# state = params[:state] if params[:state].present?
|
38
|
+
# country = params[:country] if params[:country].present?
|
39
|
+
# region = state || country || 'US'
|
40
|
+
#
|
41
|
+
# becomes
|
42
|
+
#
|
43
|
+
# region = params[:state].presence || params[:country].presence || 'US'
|
44
|
+
#
|
45
|
+
# @return [Object]
|
46
|
+
def presence
|
47
|
+
self if present?
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
class NilClass
|
52
|
+
# +nil+ is blank:
|
53
|
+
#
|
54
|
+
# nil.blank? # => true
|
55
|
+
#
|
56
|
+
# @return [true]
|
57
|
+
def blank?
|
58
|
+
true
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
class FalseClass
|
63
|
+
# +false+ is blank:
|
64
|
+
#
|
65
|
+
# false.blank? # => true
|
66
|
+
#
|
67
|
+
# @return [true]
|
68
|
+
def blank?
|
69
|
+
true
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
class TrueClass
|
74
|
+
# +true+ is not blank:
|
75
|
+
#
|
76
|
+
# true.blank? # => false
|
77
|
+
#
|
78
|
+
# @return [false]
|
79
|
+
def blank?
|
80
|
+
false
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
class Array
|
85
|
+
# An array is blank if it's empty:
|
86
|
+
#
|
87
|
+
# [].blank? # => true
|
88
|
+
# [1,2,3].blank? # => false
|
89
|
+
#
|
90
|
+
# @return [true, false]
|
91
|
+
alias_method :blank?, :empty?
|
92
|
+
end
|
93
|
+
|
94
|
+
class Hash
|
95
|
+
# A hash is blank if it's empty:
|
96
|
+
#
|
97
|
+
# {}.blank? # => true
|
98
|
+
# { key: 'value' }.blank? # => false
|
99
|
+
#
|
100
|
+
# @return [true, false]
|
101
|
+
alias_method :blank?, :empty?
|
102
|
+
end
|
103
|
+
|
104
|
+
class String
|
105
|
+
BLANK_REGEXP = /\A[[:space:]]*\z/
|
106
|
+
|
107
|
+
# A string is blank if it's empty or contains whitespaces only:
|
108
|
+
#
|
109
|
+
# ''.blank? # => true
|
110
|
+
# ' '.blank? # => true
|
111
|
+
# "\t\n\r".blank? # => true
|
112
|
+
# ' blah '.blank? # => false
|
113
|
+
#
|
114
|
+
# Unicode whitespace is supported:
|
115
|
+
#
|
116
|
+
# "\u00a0".blank? # => true
|
117
|
+
#
|
118
|
+
# @return [true, false]
|
119
|
+
def blank?
|
120
|
+
BLANK_REGEXP === self
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
class Numeric #:nodoc:
|
125
|
+
# No number is blank:
|
126
|
+
#
|
127
|
+
# 1.blank? # => false
|
128
|
+
# 0.blank? # => false
|
129
|
+
#
|
130
|
+
# @return [false]
|
131
|
+
def blank?
|
132
|
+
false
|
133
|
+
end
|
134
|
+
end
|
135
|
+
# rubocop:enable all
|
data/lib/r2-oas/version.rb
CHANGED
data/r2-oas.gemspec
CHANGED
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
|
|
37
37
|
spec.add_runtime_dependency 'eventmachine', '>= 1.2.0'
|
38
38
|
spec.add_runtime_dependency 'key_flatten', '>= 1.0.0'
|
39
39
|
spec.add_runtime_dependency 'paint'
|
40
|
-
spec.add_runtime_dependency '
|
40
|
+
spec.add_runtime_dependency 'railties', '>= 4.2.5'
|
41
41
|
spec.add_runtime_dependency 'terminal-table', '>= 1.6.0'
|
42
42
|
spec.add_runtime_dependency 'watir', '>= 6.16.5'
|
43
43
|
spec.add_development_dependency 'bundler', '>= 1.17'
|
@@ -47,4 +47,5 @@ Gem::Specification.new do |spec|
|
|
47
47
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
48
48
|
spec.add_development_dependency 'rubocop'
|
49
49
|
spec.add_development_dependency 'appraisal'
|
50
|
+
spec.add_development_dependency 'activerecord', '>= 4.2.5'
|
50
51
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: r2-oas
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yukihirop
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docker-api
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: railties
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
@@ -220,16 +220,31 @@ dependencies:
|
|
220
220
|
- - ">="
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: '0'
|
223
|
+
- !ruby/object:Gem::Dependency
|
224
|
+
name: activerecord
|
225
|
+
requirement: !ruby/object:Gem::Requirement
|
226
|
+
requirements:
|
227
|
+
- - ">="
|
228
|
+
- !ruby/object:Gem::Version
|
229
|
+
version: 4.2.5
|
230
|
+
type: :development
|
231
|
+
prerelease: false
|
232
|
+
version_requirements: !ruby/object:Gem::Requirement
|
233
|
+
requirements:
|
234
|
+
- - ">="
|
235
|
+
- !ruby/object:Gem::Version
|
236
|
+
version: 4.2.5
|
223
237
|
description: "== Let's intuitively write API documentation with Swagger Editor in
|
224
238
|
your Rails Project! \U0001F60A\nConfigureless and no DSL. \U0001F44D But you can
|
225
|
-
also configure. \
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
exec rake routes:oas:
|
230
|
-
exec rake routes:oas:
|
231
|
-
exec rake routes:oas:
|
232
|
-
exec rake routes:oas:
|
239
|
+
also configure. \nManage with yaml file instead of Ruby code. \nLoosely coupled
|
240
|
+
to your Rails project. \U0001F44D \nSo if you want to use another tool, you can
|
241
|
+
port it right away. \U0001F622 \nGenerate api docment(OpenAPI) side only from `Rails`
|
242
|
+
routing. \n \nProvide rake tasks to management API Docment (OpenAPI) \U0001F389
|
243
|
+
\ \n \n\n $ bundle exec rake routes:oas:docs\n $ bundle exec rake routes:oas:ui\n
|
244
|
+
\ $ bundle exec rake routes:oas:editor\n $ bundle exec rake routes:oas:monitor\n
|
245
|
+
\ $ bundle exec rake routes:oas:dist\n $ bundle exec rake routes:oas:clean\n
|
246
|
+
\ $ bundle exec rake routes:oas:analyze\n $ bundle exec rake routes:oas:deploy\n\n
|
247
|
+
\ \nHappy Coding ❗️\n"
|
233
248
|
email:
|
234
249
|
- te108186@gmail.com
|
235
250
|
executables: []
|
@@ -313,6 +328,8 @@ files:
|
|
313
328
|
- lib/r2-oas/hooks/global_hook.rb
|
314
329
|
- lib/r2-oas/hooks/hook.rb
|
315
330
|
- lib/r2-oas/hooks/repository.rb
|
331
|
+
- lib/r2-oas/lib/core_ext/hash/deep_merge.rb
|
332
|
+
- lib/r2-oas/lib/core_ext/object/blank.rb
|
316
333
|
- lib/r2-oas/lib/three-way-merge/twm.rb
|
317
334
|
- lib/r2-oas/logger/stdout_logger.rb
|
318
335
|
- lib/r2-oas/pluggable_configuration.rb
|
@@ -401,9 +418,9 @@ licenses:
|
|
401
418
|
- MIT
|
402
419
|
metadata:
|
403
420
|
bug_tracker_uri: https://github.com/yukihirop/r2-oas/issues
|
404
|
-
changelog_uri: https://github.com/yukihirop/r2-oas/blob/v0.3.
|
421
|
+
changelog_uri: https://github.com/yukihirop/r2-oas/blob/v0.3.1/CHANGELOG.md
|
405
422
|
documentation_uri: https://yukihirop.github.io/r2-oas
|
406
|
-
source_code_uri: https://github.com/yukihirop/r2-oas/tree/v0.3.
|
423
|
+
source_code_uri: https://github.com/yukihirop/r2-oas/tree/v0.3.1
|
407
424
|
post_install_message:
|
408
425
|
rdoc_options: []
|
409
426
|
require_paths:
|