grape-swagger-entity 0.2.5 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +6 -0
- data/Gemfile +2 -0
- data/grape-swagger-entity.gemspec +1 -1
- data/lib/grape-swagger/entity/parser.rb +6 -5
- data/lib/grape-swagger/entity/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 05c52de504600d57fb8bb41dff26265beb90d32e
|
4
|
+
data.tar.gz: 6b829aae12775c2f27521cf08be88f56298158d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9dc4d2973ef5f678eddce41c1c5a393f26267cf177b6f2973fd804d278adaa0c5c065cd4ac7b5a8006d561a896350064f96f10043f144071d51e1b402279dcc9
|
7
|
+
data.tar.gz: a5b0c18af91a1c16c6f8c2d834950dcc82885e375c29b3b6c3547d7481718c31b59fb157aa233e0a49ad6eb9e292001c6a241e2a1e933e092ea872120dd1f16d
|
data/CHANGELOG.md
CHANGED
@@ -8,6 +8,12 @@
|
|
8
8
|
|
9
9
|
* Your contribution here.
|
10
10
|
|
11
|
+
### 0.3.0 (August 22, 2018)
|
12
|
+
|
13
|
+
#### Features
|
14
|
+
|
15
|
+
* [#35](https://github.com/ruby-grape/grape-swagger-entity/pull/35): Support for required attributes - [@Bugagazavr](https://github.com/Bugagazavr).
|
16
|
+
|
11
17
|
### 0.2.5 (April 26, 2018)
|
12
18
|
|
13
19
|
#### Features
|
data/Gemfile
CHANGED
@@ -16,6 +16,8 @@ group :development, :test do
|
|
16
16
|
gem 'rubocop', '~> 0.48'
|
17
17
|
end
|
18
18
|
|
19
|
+
gem 'grape-swagger', git: 'https://github.com/ruby-grape/grape-swagger.git'
|
20
|
+
|
19
21
|
group :test do
|
20
22
|
gem 'grape-entity', ENV.fetch('GRAPE_ENTITY', '0.6.1')
|
21
23
|
gem 'ruby-grape-danger', '~> 0.1.1', require: false
|
@@ -22,7 +22,8 @@ module GrapeSwagger
|
|
22
22
|
if value.for_merge && (value.respond_to?(:entity_class) || value.respond_to?(:using_class_name))
|
23
23
|
entity_class = value.respond_to?(:entity_class) ? value.entity_class : value.using_class_name
|
24
24
|
|
25
|
-
|
25
|
+
extracted_params = extract_params(entity_class)
|
26
|
+
memo.merge!(extracted_params)
|
26
27
|
else
|
27
28
|
memo[value.attribute] = value.send(:options)
|
28
29
|
end
|
@@ -32,7 +33,7 @@ module GrapeSwagger
|
|
32
33
|
def parse_grape_entity_params(params, parent_model = nil)
|
33
34
|
return unless params
|
34
35
|
|
35
|
-
params.each_with_object({}) do |(entity_name, entity_options), memo|
|
36
|
+
parsed = params.each_with_object({}) do |(entity_name, entity_options), memo|
|
36
37
|
next if entity_options.fetch(:documentation, {}).fetch(:in, nil).to_s == 'header'
|
37
38
|
|
38
39
|
final_entity_name = entity_options.fetch(:as, entity_name)
|
@@ -48,6 +49,8 @@ module GrapeSwagger
|
|
48
49
|
memo[final_entity_name][:readOnly] = documentation[:read_only].to_s == 'true' if documentation[:read_only]
|
49
50
|
memo[final_entity_name][:description] = documentation[:desc] if documentation[:desc]
|
50
51
|
end
|
52
|
+
|
53
|
+
[parsed, required_params(params)]
|
51
54
|
end
|
52
55
|
|
53
56
|
def parse_nested(entity_name, entity_options, parent_model = nil)
|
@@ -61,9 +64,7 @@ module GrapeSwagger
|
|
61
64
|
memo[value.attribute] = value.send(:options)
|
62
65
|
end
|
63
66
|
|
64
|
-
required =
|
65
|
-
|
66
|
-
properties = parse_grape_entity_params(params, nested_entity)
|
67
|
+
properties, required = parse_grape_entity_params(params, nested_entity)
|
67
68
|
is_a_collection = entity_options[:documentation].is_a?(Hash) &&
|
68
69
|
entity_options[:documentation][:type].to_s.casecmp('array').zero?
|
69
70
|
|
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.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kirill Zaitsev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: grape-entity
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.31.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: 0.
|
40
|
+
version: 0.31.0
|
41
41
|
description:
|
42
42
|
email:
|
43
43
|
- kirik910@gmail.com
|
@@ -84,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
84
84
|
version: '0'
|
85
85
|
requirements: []
|
86
86
|
rubyforge_project:
|
87
|
-
rubygems_version: 2.
|
87
|
+
rubygems_version: 2.5.2
|
88
88
|
signing_key:
|
89
89
|
specification_version: 4
|
90
90
|
summary: Grape swagger adapter to support grape-entity object parsing
|