grape-swagger-entity 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +31 -2
- data/.rubocop_todo.yml +22 -23
- data/.travis.yml +6 -8
- data/CHANGELOG.md +5 -1
- data/Dangerfile +2 -0
- data/Gemfile +5 -3
- data/Rakefile +2 -0
- data/bin/pry +1 -0
- data/grape-swagger-entity.gemspec +5 -3
- data/lib/grape-swagger-entity.rb +2 -0
- data/lib/grape-swagger/entity.rb +2 -0
- data/lib/grape-swagger/entity/attribute_parser.rb +4 -3
- data/lib/grape-swagger/entity/helper.rb +3 -1
- data/lib/grape-swagger/entity/parser.rb +3 -0
- data/lib/grape-swagger/entity/version.rb +3 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45d768ff8d366802a511df94e675aed675d4961c965ac39a130df0e5a5a47f73
|
4
|
+
data.tar.gz: 29289e700cb29cd5d7078b58e04bb284c5ccad4da1f12e24917d31351cb2210c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1f7cb9609b3412b6fb624aaae0346b34549349a40f7912d1c72131fa7c905f47f8307928edb18dbcbc3ba6cefed34ecd861c125b60b45d8cbe1f4633a036199
|
7
|
+
data.tar.gz: b64399e310447774459e470cb7e9aa1621e2c544641ef16c6ec2e8a3a8cb472fff9cd8e33167a2b61d4939932aaca065172b01526ad099f0011fe989b2e4cdb0
|
data/.rubocop.yml
CHANGED
@@ -2,7 +2,7 @@ AllCops:
|
|
2
2
|
Exclude:
|
3
3
|
- vendor/**/*
|
4
4
|
TargetRubyVersion:
|
5
|
-
2.
|
5
|
+
2.7
|
6
6
|
|
7
7
|
inherit_from: .rubocop_todo.yml
|
8
8
|
|
@@ -21,5 +21,34 @@ Metrics/MethodLength:
|
|
21
21
|
Naming/FileName:
|
22
22
|
Enabled: false
|
23
23
|
|
24
|
-
Layout/
|
24
|
+
Layout/FirstHashElementIndentation:
|
25
25
|
EnforcedStyle: consistent
|
26
|
+
|
27
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
28
|
+
Enabled: true
|
29
|
+
Layout/SpaceAroundMethodCallOperator:
|
30
|
+
Enabled: true
|
31
|
+
Lint/DeprecatedOpenSSLConstant:
|
32
|
+
Enabled: true
|
33
|
+
Lint/MixedRegexpCaptureTypes:
|
34
|
+
Enabled: true
|
35
|
+
Lint/RaiseException:
|
36
|
+
Enabled: true
|
37
|
+
Lint/StructNewOverride:
|
38
|
+
Enabled: true
|
39
|
+
Style/ExponentialNotation:
|
40
|
+
Enabled: true
|
41
|
+
Style/HashEachMethods:
|
42
|
+
Enabled: true
|
43
|
+
Style/HashTransformKeys:
|
44
|
+
Enabled: true
|
45
|
+
Style/HashTransformValues:
|
46
|
+
Enabled: true
|
47
|
+
Style/RedundantFetchBlock:
|
48
|
+
Enabled: true
|
49
|
+
Style/RedundantRegexpCharacterClass:
|
50
|
+
Enabled: true
|
51
|
+
Style/RedundantRegexpEscape:
|
52
|
+
Enabled: true
|
53
|
+
Style/SlicingWithRange:
|
54
|
+
Enabled: true
|
data/.rubocop_todo.yml
CHANGED
@@ -1,49 +1,48 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2020-06-29 22:12:50 UTC using RuboCop version 0.86.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
# Offense count: 2
|
10
|
-
Metrics/AbcSize:
|
11
|
-
Max: 40
|
12
|
-
|
13
9
|
# Offense count: 1
|
14
|
-
# Configuration parameters:
|
15
|
-
|
16
|
-
|
10
|
+
# Configuration parameters: Include.
|
11
|
+
# Include: **/*.gemspec
|
12
|
+
Gemspec/RequiredRubyVersion:
|
13
|
+
Exclude:
|
14
|
+
- 'grape-swagger-entity.gemspec'
|
15
|
+
|
16
|
+
# Offense count: 4
|
17
|
+
# Configuration parameters: IgnoredMethods.
|
18
|
+
Metrics/AbcSize:
|
19
|
+
Max: 30
|
17
20
|
|
18
21
|
# Offense count: 1
|
19
22
|
# Configuration parameters: CountComments.
|
20
23
|
Metrics/ClassLength:
|
21
|
-
Max:
|
24
|
+
Max: 111
|
22
25
|
|
23
|
-
# Offense count:
|
26
|
+
# Offense count: 2
|
27
|
+
# Configuration parameters: IgnoredMethods.
|
24
28
|
Metrics/CyclomaticComplexity:
|
25
|
-
Max:
|
26
|
-
|
27
|
-
# Offense count: 14
|
28
|
-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
29
|
-
# URISchemes: http, https
|
30
|
-
Metrics/LineLength:
|
31
|
-
Max: 120
|
29
|
+
Max: 11
|
32
30
|
|
33
|
-
# Offense count:
|
34
|
-
# Configuration parameters: CountComments.
|
31
|
+
# Offense count: 5
|
32
|
+
# Configuration parameters: CountComments, ExcludedMethods.
|
35
33
|
Metrics/MethodLength:
|
36
|
-
Max:
|
34
|
+
Max: 25
|
37
35
|
|
38
36
|
# Offense count: 2
|
37
|
+
# Configuration parameters: IgnoredMethods.
|
39
38
|
Metrics/PerceivedComplexity:
|
40
|
-
Max:
|
39
|
+
Max: 12
|
41
40
|
|
42
|
-
# Offense count:
|
41
|
+
# Offense count: 4
|
43
42
|
Style/Documentation:
|
44
43
|
Exclude:
|
45
44
|
- 'spec/**/*'
|
46
45
|
- 'test/**/*'
|
47
46
|
- 'lib/grape-swagger/entity.rb'
|
48
|
-
- 'lib/grape-swagger/entity/parser.rb'
|
49
47
|
- 'lib/grape-swagger/entity/attribute_parser.rb'
|
48
|
+
- 'lib/grape-swagger/entity/parser.rb'
|
data/.travis.yml
CHANGED
@@ -10,29 +10,27 @@ after_success:
|
|
10
10
|
- bundle exec danger
|
11
11
|
|
12
12
|
rvm:
|
13
|
-
- 2.
|
14
|
-
- 2.
|
15
|
-
- 2.
|
13
|
+
- 2.5.8
|
14
|
+
- 2.6.6
|
15
|
+
- 2.7.1
|
16
16
|
|
17
17
|
env:
|
18
18
|
- GRAPE_ENTITY=0.6.1
|
19
19
|
- GRAPE_ENTITY=0.7.1
|
20
|
+
- GRAPE_ENTITY=0.8.0
|
20
21
|
|
21
22
|
matrix:
|
22
23
|
fast_finish: true
|
23
24
|
|
24
25
|
include:
|
25
|
-
- rvm: 2.
|
26
|
+
- rvm: 2.4.10
|
26
27
|
env:
|
27
28
|
- rvm: ruby-head
|
28
29
|
env:
|
29
30
|
- rvm: jruby-head
|
30
31
|
env:
|
31
|
-
- rvm: rbx-2
|
32
|
-
env:
|
33
32
|
|
34
33
|
allow_failures:
|
35
|
-
- rvm: 2.
|
34
|
+
- rvm: 2.4.10
|
36
35
|
- rvm: ruby-head
|
37
36
|
- rvm: jruby-head
|
38
|
-
- rvm: rbx-2
|
data/CHANGELOG.md
CHANGED
@@ -8,12 +8,16 @@
|
|
8
8
|
|
9
9
|
* Your contribution here.
|
10
10
|
|
11
|
-
### 0.5.
|
11
|
+
### 0.5.1 (June 30, 2020)
|
12
12
|
|
13
13
|
#### Features
|
14
14
|
|
15
15
|
* [#50](https://github.com/ruby-grape/grape-swagger-entity/pull/50): Features/inheritance and discriminator - [@MaximeRDY](https://github.com/MaximeRDY).
|
16
16
|
|
17
|
+
### 0.5.0 (June 29, 2020)
|
18
|
+
|
19
|
+
Yanked due to invalid dependency
|
20
|
+
|
17
21
|
### 0.4.0 (May 30, 2020)
|
18
22
|
|
19
23
|
#### Features
|
data/Dangerfile
CHANGED
data/Gemfile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
source 'https://rubygems.org'
|
2
4
|
|
3
5
|
# Specify your gem's dependencies in grape-swagger-entity.gemspec
|
@@ -12,11 +14,11 @@ group :development, :test do
|
|
12
14
|
gem 'rack-test'
|
13
15
|
gem 'rake'
|
14
16
|
gem 'rdoc'
|
15
|
-
gem 'rspec', '~> 3.
|
16
|
-
gem 'rubocop', '~> 0.
|
17
|
+
gem 'rspec', '~> 3.9'
|
18
|
+
gem 'rubocop', '~> 0.85'
|
17
19
|
end
|
18
20
|
|
19
|
-
gem 'grape-swagger',
|
21
|
+
gem 'grape-swagger', git: 'https://github.com/ruby-grape/grape-swagger.git'
|
20
22
|
|
21
23
|
group :test do
|
22
24
|
gem 'grape-entity', ENV.fetch('GRAPE_ENTITY', '0.6.1')
|
data/Rakefile
CHANGED
data/bin/pry
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
lib = File.expand_path('lib', __dir__)
|
2
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
5
|
require 'grape-swagger/entity/version'
|
@@ -17,7 +19,7 @@ Gem::Specification.new do |s|
|
|
17
19
|
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
18
20
|
s.require_paths = ['lib']
|
19
21
|
|
20
|
-
s.required_ruby_version = '>= 2.
|
21
|
-
s.add_runtime_dependency 'grape-entity', '>= 0.
|
22
|
-
s.add_runtime_dependency 'grape-swagger', '>= 1.
|
22
|
+
s.required_ruby_version = '>= 2.4'
|
23
|
+
s.add_runtime_dependency 'grape-entity', '>= 0.6.0'
|
24
|
+
s.add_runtime_dependency 'grape-swagger', '>= 1.2.0'
|
23
25
|
end
|
data/lib/grape-swagger-entity.rb
CHANGED
data/lib/grape-swagger/entity.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module GrapeSwagger
|
2
4
|
module Entity
|
3
5
|
class AttributeParser
|
@@ -65,8 +67,7 @@ module GrapeSwagger
|
|
65
67
|
end
|
66
68
|
|
67
69
|
def ambiguous_model_type?(type)
|
68
|
-
type &&
|
69
|
-
type.is_a?(Class) &&
|
70
|
+
type&.is_a?(Class) &&
|
70
71
|
!GrapeSwagger::DocMethods::DataType.primitive?(type.name.downcase) &&
|
71
72
|
!type == Array
|
72
73
|
end
|
@@ -87,7 +88,7 @@ module GrapeSwagger
|
|
87
88
|
else
|
88
89
|
{ type: data_type }
|
89
90
|
end
|
90
|
-
type[:format] = documentation[:format] if documentation
|
91
|
+
type[:format] = documentation[:format] if documentation&.key?(:format)
|
91
92
|
|
92
93
|
type
|
93
94
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module GrapeSwagger
|
2
4
|
module Entity
|
3
5
|
# Helper methods for DRY
|
@@ -13,7 +15,7 @@ module GrapeSwagger
|
|
13
15
|
|
14
16
|
def discriminator(entity_model)
|
15
17
|
entity_model.superclass.root_exposures.detect do |value|
|
16
|
-
value.documentation
|
18
|
+
value.documentation&.dig(:is_discriminator)
|
17
19
|
end
|
18
20
|
end
|
19
21
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module GrapeSwagger
|
2
4
|
module Entity
|
3
5
|
class Parser
|
@@ -19,6 +21,7 @@ module GrapeSwagger
|
|
19
21
|
|
20
22
|
class Alias
|
21
23
|
attr_reader :original, :renamed
|
24
|
+
|
22
25
|
def initialize(original, renamed)
|
23
26
|
@original = original
|
24
27
|
@renamed = renamed
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grape-swagger-entity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kirill Zaitsev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: grape-entity
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.6.0
|
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.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: grape-swagger
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.2.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
40
|
+
version: 1.2.0
|
41
41
|
description:
|
42
42
|
email:
|
43
43
|
- kirik910@gmail.com
|
@@ -77,7 +77,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
77
77
|
requirements:
|
78
78
|
- - ">="
|
79
79
|
- !ruby/object:Gem::Version
|
80
|
-
version: 2.
|
80
|
+
version: '2.4'
|
81
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
82
|
requirements:
|
83
83
|
- - ">="
|