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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: 719e50145ee34ef39de1daf50a3d495ff0221d07ee7688fea3df86c503e5de16
4
- data.tar.gz: 3c470cba6e089f1e7ffa1b5139de981ee84f5d7d3e005a464d57c8b7f54a0e02
2
+ SHA1:
3
+ metadata.gz: 05c52de504600d57fb8bb41dff26265beb90d32e
4
+ data.tar.gz: 6b829aae12775c2f27521cf08be88f56298158d5
5
5
  SHA512:
6
- metadata.gz: fc20da740449366c3df92f5850ac36865cb4d0f0404a6cb2069e82cc94ceb71f2d32b5c3ba12d4a440676e8d053402a8e60de2ac8a62504e624c574ef126dac2
7
- data.tar.gz: 7b281a8feeadbed1ff4651c92168783eaa6e7d3c5ae3e56970696c0096b7011f8a2e79d67b0cead55bab677f89788afde7ae1320ec5d5cc8ab5086416fefdd07
6
+ metadata.gz: 9dc4d2973ef5f678eddce41c1c5a393f26267cf177b6f2973fd804d278adaa0c5c065cd4ac7b5a8006d561a896350064f96f10043f144071d51e1b402279dcc9
7
+ data.tar.gz: a5b0c18af91a1c16c6f8c2d834950dcc82885e375c29b3b6c3547d7481718c31b59fb157aa233e0a49ad6eb9e292001c6a241e2a1e933e092ea872120dd1f16d
@@ -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
@@ -19,5 +19,5 @@ Gem::Specification.new do |s|
19
19
 
20
20
  s.required_ruby_version = '>= 2.2.6'
21
21
  s.add_runtime_dependency 'grape-entity', '>= 0.5.0'
22
- s.add_runtime_dependency 'grape-swagger', '>= 0.20.4'
22
+ s.add_runtime_dependency 'grape-swagger', '>= 0.31.0'
23
23
  end
@@ -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
- memo.merge!(extract_params(entity_class))
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 = required_params(params)
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
 
@@ -1,5 +1,5 @@
1
1
  module GrapeSwagger
2
2
  module Entity
3
- VERSION = '0.2.5'.freeze
3
+ VERSION = '0.3.0'.freeze
4
4
  end
5
5
  end
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.2.5
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-04-26 00:00:00.000000000 Z
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.20.4
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.20.4
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.7.6
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