mini-apivore 0.3.0 → 1.0.0

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: cd4021c1b59f97da6c130712948c65a271135cc50ebc8b38e438c9a39ea834b7
4
- data.tar.gz: 96056ed390b669092813bd6bd7b5f9fa44485719ed1d7135234d690440848c13
3
+ metadata.gz: 9b41aa027cce196be07372b0b00c0b7bb56f384c5f040fa3c03e5c62a9cf7beb
4
+ data.tar.gz: eaf1753ccad3eb94fff9aee652d70d278f6bf4863dcd79a99e008f7f9e226a3d
5
5
  SHA512:
6
- metadata.gz: 7f9d82a99a608ea35f4e78791dd1356536e9ca05f63c7698a79e509794a8b1eb313cbb93f4a96691bee4478d6d6e846a541bf5379ff0a65dbb73df8c0733f223
7
- data.tar.gz: 77e2b25f473550b9d4ea775191ccc7ecaf7fe3cb2da7e16ae7c774d67de1181c85b98786ebe87375fd361e891dec7f06931026636375a8288b402381f1ecbb9d
6
+ metadata.gz: '030206914e1144e3cf68c5f0740abc4ec254e8a7519d0af89087d28e00d483f68bd4be6067ac6b916448138971c16ddcefad2162ed5db38393f123025bcc92c1'
7
+ data.tar.gz: 61cc05bd4e2db68d5934eb4f4b2ba497cf54bdac9ff3b0ea477f3fd5788a567c17493f41c44b42c34007c54f7d703c123551a0184e4a3acd4da6658231d002cb
@@ -6,6 +6,7 @@ require "hashie"
6
6
  module MiniApivore
7
7
  class Swagger < Hash
8
8
  include Hashie::Extensions::MergeInitializer
9
+ include Hashie::Extensions::IndifferentAccess
9
10
 
10
11
  NONVERB_PATH_ITEMS = "parameters"
11
12
 
@@ -20,7 +21,7 @@ module MiniApivore
20
21
  end
21
22
 
22
23
  def version
23
- self['swagger']
24
+ self["swagger"]
24
25
  end
25
26
 
26
27
  def base_path
@@ -28,21 +29,23 @@ module MiniApivore
28
29
  end
29
30
 
30
31
  def each_response(&block)
31
- self['paths'].each do |path, path_data|
32
- next if vendor_specific_tag? path
32
+ self["paths"].each do |path, path_data|
33
+ next if vendor_specific_tag?(path)
34
+
33
35
  path_data.each do |verb, method_data|
34
36
  next if NONVERB_PATH_ITEMS.include?(verb)
35
- next if vendor_specific_tag? verb
36
- if method_data['responses'].nil?
37
+ next if vendor_specific_tag?(verb)
38
+
39
+ if method_data["responses"].nil?
37
40
  raise "No responses found in swagger for path '#{path}', " \
38
41
  "verb #{verb}: #{method_data.inspect}"
39
42
  end
40
- method_data['responses'].each do |response_code, response_data|
43
+ method_data["responses"].each do |response_code, response_data|
41
44
  schema_location = nil
42
- if response_data['$ref']
43
- schema_location = response_data['$ref']
44
- elsif response_data['schema']
45
- schema_location = Fragment.new ['#', 'paths', path, verb, 'responses', response_code, 'schema']
45
+ if response_data["$ref"]
46
+ schema_location = response_data["$ref"]
47
+ elsif response_data["schema"]
48
+ schema_location = Fragment.new(["#", "paths", path, verb, "responses", response_code, "schema"])
46
49
  end
47
50
  block.call(path, verb, response_code, schema_location)
48
51
  end
@@ -7,7 +7,7 @@ module MiniApivore
7
7
  class SwaggerChecker
8
8
  PATH_TO_CHECKER_MAP = {}
9
9
 
10
- def self.instance_for(path, schema = "")
10
+ def self.instance_for(path, schema = {})
11
11
  PATH_TO_CHECKER_MAP[path] ||= new(path, schema)
12
12
  end
13
13
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Mini
4
4
  module Apivore
5
- VERSION = "0.3.0"
5
+ VERSION = "1.0.0"
6
6
  end
7
7
  end
data/lib/mini_apivore.rb CHANGED
@@ -66,7 +66,10 @@ module MiniApivore
66
66
 
67
67
  #----- test for untested routes ---------
68
68
  def final_test
69
- return unless MiniApivore.all_test_ran?
69
+ # whenever we running tests with inheritance from some base class with dedicated schema,
70
+ # we will run final_test multiple times, one per ancestor
71
+ # so we need to assert something to eliminate warnings about zero assertions in a final_test
72
+ return assert(true) unless MiniApivore.all_test_ran?
70
73
 
71
74
  @errors = MiniApivore.prepare_untested_errors
72
75
  assert(@errors.empty?, @errors.join("\n"))
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mini-apivore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - alekseyl
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-07-08 00:00:00.000000000 Z
11
+ date: 2025-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie
@@ -134,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
134
  - !ruby/object:Gem::Version
135
135
  version: '0'
136
136
  requirements: []
137
- rubygems_version: 3.2.15
137
+ rubygems_version: 3.3.26
138
138
  signing_key:
139
139
  specification_version: 4
140
140
  summary: Minitest adaptation of an apivore gem