zero-rails_openapi 2.1.2 → 2.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 376358650e9b3247057041cb7dbc985e167201fa
4
- data.tar.gz: 5882dd98faaf60b78625367d88f8986db34d7080
3
+ metadata.gz: 6afe25b368bda3ef415c01c9fbd8c22c8cb2d544
4
+ data.tar.gz: 666ae607f905146f90ecc86b399a0af08edbfff4
5
5
  SHA512:
6
- metadata.gz: fd6cb340ea211eab201d345af76c24ba78ce50163cbb3fbf931b5346715fa1e91a456012012bb9a5e8371d9ebfd02c22869d9f55a1489e2ed94b2b794073592a
7
- data.tar.gz: 07e35bb9ef18e94e5b1a21e71cc32db95671ef862ca865be797f6ed3ff29842a3a836f91be268d57618a73edcc53c0c11390f756031474f059c78cd24fe9ce1f
6
+ metadata.gz: c87f34bdc7df1ceb1b7c2e81f825151776a45d36a98f9eb410182250adcd4ea1ca72afb1127c5c1f290a98e14730a750733e2c57cbf1ba892ebb1d7969a03097
7
+ data.tar.gz: fbf997a1b3f2d603405664e86bcbac793ae58b0067504af01af21179b2600b46761917b3932e216bd96ce56631d249aa7b43b599c4585dc55d643d21935906a5
data/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [2.1.3] - 2020/2/8 - [view diff](https://github.com/zhandao/zero-rails_openapi/compare/v2.1.2...v2.1.3)
6
+
7
+ ### Fixed
8
+
9
+ 1. Fix response HTTP Status Code's type, restrict to String [issued by @am17torres](https://github.com/zhandao/zero-rails_openapi/issues/60)
10
+
11
+ ### Added
12
+
13
+ 1. Configurable additionalProperties's default value of Object type [issued by @remuspoienar](https://github.com/zhandao/zero-rails_openapi/issues/61)
14
+
5
15
  ## [2.1.1 - 2.1.2] - 2019/2/12 - [view diff](https://github.com/zhandao/zero-rails_openapi/compare/v2.1.0...v2.1.2)
6
16
 
7
17
  ### Fixed
@@ -55,7 +55,10 @@ module OpenApi
55
55
  end
56
56
 
57
57
  def additional_properties
58
- return if processed[:type] != 'object' || _addProp.nil?
58
+ return if processed[:type] != 'object'
59
+ default = Config.additional_properties_default_value_of_type_object
60
+ return { additionalProperties: default } if _addProp.nil? && !default.nil?
61
+
59
62
  value = _addProp.in?([true, false]) ? _addProp : SchemaObj.new(_addProp, { }).process
60
63
  { additionalProperties: value }
61
64
  end
data/lib/open_api.rb CHANGED
@@ -50,7 +50,7 @@ module OpenApi
50
50
  def init_hash(doc_name)
51
51
  settings = Config.docs[doc_name]
52
52
  doc = { openapi: '3.0.0', **settings.slice(:info, :servers) }.merge!(
53
- security: settings[:global_security], tags: [ ], paths: { },
53
+ security: settings[:global_security] || [], tags: [ ], paths: { },
54
54
  components: {
55
55
  securitySchemes: settings[:securitySchemes] || { },
56
56
  schemas: { }, parameters: { }, requestBodies: { }
@@ -24,6 +24,8 @@ module OpenApi
24
24
 
25
25
  cattr_accessor(:file_format) { 'binary' }
26
26
 
27
+ cattr_accessor(:additional_properties_default_value_of_type_object) { nil }
28
+
27
29
  def self.docs
28
30
  open_api_docs
29
31
  end
@@ -96,7 +96,7 @@ module OpenApi
96
96
  end
97
97
 
98
98
  def response code, desc, media_type = nil, headers: { }, data: { }, **options
99
- (self[:responses][code] ||= ResponseObj.new(desc)).absorb(desc, media_type, headers: headers, data: data, **options)
99
+ (self[:responses][code.to_s] ||= ResponseObj.new(desc)).absorb(desc, media_type, headers: headers, data: data, **options)
100
100
  end
101
101
 
102
102
  alias_method :resp, :response
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OpenApi
4
- VERSION = '2.1.2'
4
+ VERSION = '2.1.3'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zero-rails_openapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - zhandao
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-09 00:00:00.000000000 Z
11
+ date: 2020-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler