openapi_parser 0.2.5 → 0.2.6

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: 326facafd3af7f66a13092790f063a518d866b3162a6dafe4f754ec662463ca8
4
- data.tar.gz: 5315341ecd73b796bb3126c882da253bc670f7034c35721a3b83fb23e6a7b9db
3
+ metadata.gz: 03ecb03e959dd472600018d4b8e0978cb8e4b0a1eae5c71b27b7e48aa71a7820
4
+ data.tar.gz: cae628061130aa70c56fb845efc14fc1c57b9a14ea70a13976bc508ef573a94a
5
5
  SHA512:
6
- metadata.gz: 54748ce7130061e081a5851c5100a0d4255de816107098543086131802d577965aa34dfa4a8b024eec1a4477cf2fab89f1d175ec57c01c959b3b94fbae71c8c3
7
- data.tar.gz: 8dc502b7c3d411138e049c668251f17cdf6a00d39498c5cbade0612842b89138b02aee2c64e01eabb874f445aedb61350f57e168c2171d83e9ec42c17f2f8a18
6
+ metadata.gz: 0a16babec6dfe5adb06207bab3fb746f5ac42f228aef95b4339d43998ce092073ff5c1e8b00b950fbe626e667147a715ed33e1b7bb832f3fe40e136b8bfb2117
7
+ data.tar.gz: f52fadf6c9cf1f12614c3be3e886504cb3e4377f40151dceb6714e9384697727931643beaab8b19f96c62a06448ccf871d0069159460c45cf6b20e662f12902e
@@ -1,5 +1,11 @@
1
1
  ## Unreleased
2
2
 
3
+ ## 0.2.6 (2019-05-20)
4
+ * Add support for discriminator (#32)
5
+
6
+ ## 0.2.5 (2019-04-12)
7
+ * Support one of validator (#26)
8
+
3
9
  ## 0.2.3 (2019-03-18)
4
10
  * validate_header_parameter support case incentive (#25)
5
11
 
@@ -0,0 +1,7 @@
1
+ module OpenAPIParser::DefinitionValidatable
2
+ # validate this definition is valid and return all definition errors
3
+ # @return Array
4
+ def validate_definitions(_parents)
5
+ []
6
+ end
7
+ end
@@ -88,7 +88,7 @@ class OpenAPIParser::SchemaValidator
88
88
  private
89
89
 
90
90
  # @return [OpenAPIParser::SchemaValidator::Base, nil]
91
- def validator(value, schema)
91
+ def validator(value, schema) # rubocop:disable Metrics/CyclomaticComplexity
92
92
  return any_of_validator if schema.any_of
93
93
  return all_of_validator if schema.all_of
94
94
  return one_of_validator if schema.one_of
@@ -5,6 +5,8 @@
5
5
 
6
6
  module OpenAPIParser::Schemas
7
7
  class OpenAPI < Base
8
+ include OpenAPIParser::DefinitionValidatable
9
+
8
10
  def initialize(raw_schema, config)
9
11
  super('#', nil, self, raw_schema)
10
12
  @find_object_cache = {}
@@ -28,5 +30,17 @@ module OpenAPIParser::Schemas
28
30
  def request_operation(http_method, request_path)
29
31
  OpenAPIParser::RequestOperation.create(http_method, request_path, @path_item_finder, @config)
30
32
  end
33
+
34
+ # return the definition is valid or not
35
+ # @return Boolean
36
+ def valid_definition?
37
+ openapi_definition_errors.empty?
38
+ end
39
+
40
+ # return definition errors
41
+ # @return Array
42
+ def openapi_definition_errors
43
+ @openapi_definition_errors ||= validate_definitions([])
44
+ end
31
45
  end
32
46
  end
@@ -1,3 +1,3 @@
1
1
  module OpenAPIParser
2
- VERSION = '0.2.5'.freeze
2
+ VERSION = '0.2.6'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openapi_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - ota42y
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-25 00:00:00.000000000 Z
11
+ date: 2019-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -144,6 +144,7 @@ files:
144
144
  - bin/setup
145
145
  - lib/openapi_parser.rb
146
146
  - lib/openapi_parser/concern.rb
147
+ - lib/openapi_parser/concerns/definition_validatable.rb
147
148
  - lib/openapi_parser/concerns/expandable.rb
148
149
  - lib/openapi_parser/concerns/findable.rb
149
150
  - lib/openapi_parser/concerns/media_type_selectable.rb