grape_openapi3 0.1.1 → 0.1.2

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
  SHA256:
3
- metadata.gz: f0f1cd37cbd82e6e03da9a91253742ef3ce87db8796312f1e54e3da6d6681cd7
4
- data.tar.gz: 1875b127d847677e442a39031137c1aff3302f1ca3c1f5308346f90c07f8790c
3
+ metadata.gz: 0b766639dad295072af7561e8f833b1324b40cf8fbe3dd541f50b28f584b776a
4
+ data.tar.gz: ae90d2dfa58d2b6de7739fb4da1133b6e6e1bdbee54c9be6446de073989de9c2
5
5
  SHA512:
6
- metadata.gz: 520dce2913d16f0b748c2cb6be734adf73dae6c0981f7639a9d3a2be4ae38355d18f4ffaaae040777a4f0cb37334dfe4d4c03476b7829e8d4744d2d61c9a267b
7
- data.tar.gz: 8a043d71e49e6e40fb58e8da45378932e8a5c73bbf165c136ca03221464ceaca4e89d777538d1f5c407cc89a7f62b50096ed2c063d624db47273e2fef48ea73d
6
+ metadata.gz: ceffb4098ee59dc64bf447603126f56ec62a422abec5c525aa48fc45fe71c2c30f7ab4eb276a9ba30fba1a46cfbc6a6317ebdad332b649d55c310ebd65b3105f
7
+ data.tar.gz: d74161cb5c277c94bb578a2dadc54ab5878586fd44e51de024242375a5f1840212b25d83bc8746e0bb06199e86d5112f6150b5c295032a9cba29d0f61a23e573
@@ -57,6 +57,9 @@ module GrapeOpenapi3
57
57
  private
58
58
 
59
59
  def location(name, defn)
60
+ # Path segments are structural — they always win over any explicit hint.
61
+ return :path if @path_names.include?(name)
62
+
60
63
  explicit = defn.dig(:documentation, :param_type)&.to_s ||
61
64
  defn.dig(:documentation, :in)&.to_s
62
65
 
@@ -68,8 +71,7 @@ module GrapeOpenapi3
68
71
  when "formData" then return :form
69
72
  end
70
73
 
71
- return :path if @path_names.include?(name)
72
- return :form if file_type?(defn[:type])
74
+ return :form if file_type?(defn[:type])
73
75
  BODY_METHODS.include?(@method) ? :body : :query
74
76
  end
75
77
 
@@ -116,8 +118,9 @@ module GrapeOpenapi3
116
118
 
117
119
  params.each do |name, defn|
118
120
  schema = TypeMapper.call(defn[:type] || String)
119
- schema["enum"] = Array(defn[:values]) if defn[:values]
120
- schema["default"] = defn[:default] unless defn[:default].nil?
121
+ schema["enum"] = Array(defn[:values]) if defn[:values]
122
+ schema["default"] = defn[:default] unless defn[:default].nil?
123
+ schema["nullable"] = true unless defn[:required]
121
124
 
122
125
  desc = defn[:desc] || defn[:description]
123
126
  schema["description"] = desc.to_s if desc
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GrapeOpenapi3
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape_openapi3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - rodrigonbarreto