apia-open_api 0.1.2 → 0.1.3

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
2
  SHA256:
3
- metadata.gz: e088b172e1ebbabca8a2520ecb0958e3663bc36231a84f06191057500fb9ca60
4
- data.tar.gz: ea8b66ea6a4bcd2fe9a8fb94c632034ae6166c49e9a22c75469fe5a8d93d9a2f
3
+ metadata.gz: 3a45fd172c715b417ff39eca615ecf87f12b49d68a3a0b005702be43e1cce2b7
4
+ data.tar.gz: 0bc1c81f27016b6df2085c3968ef1262a8d2630533a6e836bd786940b5c6bb7d
5
5
  SHA512:
6
- metadata.gz: 16d96e51f64037afe00b2b8dcddedfb0f1aa9f98d4bbb9effab44094b3db1d82aa4351cbab692002f36a60ee2727a16ebf7557f5a5e906bd4f6ae25590bc113d
7
- data.tar.gz: 7e18b018812c02900b10b1948e27c9b631cd8099beab1c1f1880557b0c4b7d1173d6204a77c55a355f5bb9c1de20ff6925980e4c0ec8c1f2c649c38acfa3dfb9
6
+ metadata.gz: 0b0c1e241009a2cebd05ad12a654fab114634ebd3a9eb2aa29e7134cbf6c87e6b8ffae9bfa1b62e5339308475b9b610adfae3197bd56450d7bd5b1229ca119e7
7
+ data.tar.gz: 2650e1efa99461dd62ae0359baee53aa494d312655ead60df13ba4a4384b08461a99c0e8bef9a7ae6d60f6411a12229ff1c36fdb325a45ac168c269da430a397
@@ -211,7 +211,7 @@ module Apia
211
211
  end
212
212
 
213
213
  def generate_ref(namespace, http_status_code, definitions)
214
- id = generate_id_for_error_ref(http_status_code, definitions)
214
+ id = generate_id_for_error_ref(namespace, http_status_code, definitions)
215
215
  if namespace == "responses"
216
216
  add_to_responses_components(http_status_code, definitions, id)
217
217
  else
@@ -220,16 +220,17 @@ module Apia
220
220
  { "$ref": "#/components/#{namespace}/#{id}" }
221
221
  end
222
222
 
223
- def generate_id_for_error_ref(http_status_code, definitions)
223
+ def generate_id_for_error_ref(namespace, http_status_code, definitions)
224
+ suffix = namespace == "responses" ? "Response" : "Schema"
224
225
  api_authenticator_error_defs = api_authenticator_potential_errors.map(&:definition).select do |d|
225
226
  d.http_status_code.to_s == http_status_code.to_s
226
227
  end
227
228
  if api_authenticator_error_defs.any? && api_authenticator_error_defs == definitions
228
- "APIAuthenticator#{http_status_code}Response"
229
+ "APIAuthenticator#{http_status_code}#{suffix}"
229
230
  elsif definitions.length == 1
230
- "#{generate_id_from_definition(definitions.first)}Response"
231
+ "#{generate_id_from_definition(definitions.first)}#{suffix}"
231
232
  else
232
- generate_short_error_ref(http_status_code, definitions, api_authenticator_error_defs)
233
+ generate_short_error_ref(suffix, http_status_code, definitions, api_authenticator_error_defs)
233
234
  end
234
235
  end
235
236
 
@@ -238,7 +239,7 @@ module Apia
238
239
  # If this is too long, we use only the first and last two error names. Error names are sorted
239
240
  # alphabetically, which should ensure we do not generate the same ID to represent different sets of errors.
240
241
  # The length is important because the rubygems gem builder imposes a 100 character limit on filenames.
241
- def generate_short_error_ref(http_status_code, definitions, api_authenticator_error_defs)
242
+ def generate_short_error_ref(suffix, http_status_code, definitions, api_authenticator_error_defs)
242
243
  generated_ids = (definitions - api_authenticator_error_defs).map do |d|
243
244
  generate_id_from_definition(d)
244
245
  end.sort
@@ -248,7 +249,7 @@ module Apia
248
249
  [
249
250
  (sliced_ids || generated_ids).join,
250
251
  http_status_code,
251
- "Error"
252
+ suffix.first(3)
252
253
  ].flatten.join("_").camelize
253
254
  end
254
255
 
@@ -3,7 +3,7 @@
3
3
  module Apia
4
4
  module OpenApi
5
5
 
6
- VERSION = "0.1.2"
6
+ VERSION = "0.1.3"
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.2
4
+ version: 0.1.3
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-11 00:00:00.000000000 Z
11
+ date: 2023-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport