apia-open_api 0.1.4 → 0.1.5

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: f046cce05d4154ba36e9f52227306129ef092e75061db7a522b44ade60b252c0
4
- data.tar.gz: 2c56c6cedf8281819ca4c6382159183cdcc0c550d27375410f7f39cfe4bb842a
3
+ metadata.gz: d7c3d54619c699cf9edca73ebc76e68819c2656f0259adbd6d5e411d4e415ca6
4
+ data.tar.gz: f31e758e511dd57af96896cd9ca956e6455c29747fc8389d5bda59a6c5938f3d
5
5
  SHA512:
6
- metadata.gz: 9c60e070b4a683379b689fff7c95ba8a7aa6ea9f2902e13b68474190b2aac234feec2428c73871591b467af2ba17be21c2dcb6d8b2297014a88e1ec783311472
7
- data.tar.gz: afce3695675df681249591575c3704161caa3dd66b91a67e89bc67e58b07d45d8d6445e0080f7264c2a0fb234f1a03f87eec97aeeba22e39bf873f991b38452b
6
+ metadata.gz: 1f96b6eca24cc4d97d4e248892adf62bce141c4d4cce4697c8141cd1b844465d7ce9ef33036daddee81bf908dd41b4cc1bcad2b4436bc2cd1aef431e8fba8602
7
+ data.tar.gz: 1754bd390af23a0c88658c9a58b7c367f1743df4021a2f47c186720b3b3ff8235be743adaf62d0a3613502ae22267264f6aea71ae44ab716ba5ca8b86257345d
@@ -40,7 +40,7 @@ module Apia
40
40
  @definition = definition
41
41
  @schema = schema
42
42
  @id = id
43
- @endpoint = endpoint
43
+ @endpoint = endpoint # endpoint gets specified when we are dealing with a partial response
44
44
  @path = path
45
45
  @children = []
46
46
  end
@@ -130,6 +130,10 @@ module Apia
130
130
  schema[:properties][child.name.to_s] = generate_scalar_schema(child)
131
131
  end
132
132
 
133
+ if child.try(:null?)
134
+ schema[:properties][child.name.to_s][:nullable] = true
135
+ end
136
+
133
137
  if child.try(:required?)
134
138
  schema[:required] ||= []
135
139
  schema[:required] << child.name.to_s
@@ -141,7 +145,7 @@ module Apia
141
145
  schema[:type] = "object"
142
146
  schema[:properties] ||= {}
143
147
  if all_properties_included
144
- schema[:properties][child.name.to_s] = generate_schema_ref(child)
148
+ ref = generate_schema_ref(child)
145
149
  else
146
150
  child_path = @path.nil? ? nil : @path + [child]
147
151
 
@@ -149,13 +153,16 @@ module Apia
149
153
  # very long IDs, so we truncate them to avoid hitting the 100 character
150
154
  # filename limit imposed by the rubygems gem builder.
151
155
  truncated_id = @id.match(/^(.*?)\d*?(Response|Part).*$/)[1]
152
- schema[:properties][child.name.to_s] = generate_schema_ref(
156
+ ref = generate_schema_ref(
153
157
  child,
154
158
  id: "#{truncated_id}Part_#{child.name}".camelize,
155
159
  endpoint: @endpoint,
156
160
  path: child_path
157
161
  )
158
162
  end
163
+
164
+ # Using allOf is a workaround to allow us to set a ref as `nullable` in OpenAPI 3.0
165
+ schema[:properties][child.name.to_s] = { allOf: [ref] }
159
166
  end
160
167
 
161
168
  end
@@ -3,7 +3,7 @@
3
3
  module Apia
4
4
  module OpenApi
5
5
 
6
- VERSION = "0.1.4"
6
+ VERSION = "0.1.5"
7
7
 
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apia-open_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Sturgess
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-14 00:00:00.000000000 Z
11
+ date: 2024-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -70,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
70
  - !ruby/object:Gem::Version
71
71
  version: '0'
72
72
  requirements: []
73
- rubygems_version: 3.4.10
73
+ rubygems_version: 3.4.19
74
74
  signing_key:
75
75
  specification_version: 4
76
76
  summary: Apia OpenAPI spec generator