openapi3_parser 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/.rspec +1 -0
- data/.rubocop.yml +9 -0
- data/.ruby-version +1 -0
- data/.travis.yml +4 -0
- data/Gemfile +5 -0
- data/LICENCE +19 -0
- data/README.md +32 -0
- data/Rakefile +10 -0
- data/TODO.md +30 -0
- data/lib/openapi3_parser.rb +39 -0
- data/lib/openapi3_parser/context.rb +54 -0
- data/lib/openapi3_parser/document.rb +48 -0
- data/lib/openapi3_parser/error.rb +5 -0
- data/lib/openapi3_parser/fields/map.rb +83 -0
- data/lib/openapi3_parser/node.rb +115 -0
- data/lib/openapi3_parser/node/map.rb +24 -0
- data/lib/openapi3_parser/node/object.rb +28 -0
- data/lib/openapi3_parser/node_factories/array.rb +105 -0
- data/lib/openapi3_parser/node_factories/callback.rb +26 -0
- data/lib/openapi3_parser/node_factories/components.rb +83 -0
- data/lib/openapi3_parser/node_factories/contact.rb +24 -0
- data/lib/openapi3_parser/node_factories/discriminator.rb +31 -0
- data/lib/openapi3_parser/node_factories/encoding.rb +34 -0
- data/lib/openapi3_parser/node_factories/example.rb +25 -0
- data/lib/openapi3_parser/node_factories/external_documentation.rb +23 -0
- data/lib/openapi3_parser/node_factories/header.rb +36 -0
- data/lib/openapi3_parser/node_factories/info.rb +28 -0
- data/lib/openapi3_parser/node_factories/license.rb +22 -0
- data/lib/openapi3_parser/node_factories/link.rb +40 -0
- data/lib/openapi3_parser/node_factories/map.rb +110 -0
- data/lib/openapi3_parser/node_factories/media_type.rb +44 -0
- data/lib/openapi3_parser/node_factories/oauth_flow.rb +24 -0
- data/lib/openapi3_parser/node_factories/oauth_flows.rb +31 -0
- data/lib/openapi3_parser/node_factories/openapi.rb +50 -0
- data/lib/openapi3_parser/node_factories/operation.rb +76 -0
- data/lib/openapi3_parser/node_factories/parameter.rb +43 -0
- data/lib/openapi3_parser/node_factories/parameter/parameter_like.rb +37 -0
- data/lib/openapi3_parser/node_factories/path_item.rb +75 -0
- data/lib/openapi3_parser/node_factories/paths.rb +32 -0
- data/lib/openapi3_parser/node_factories/reference.rb +33 -0
- data/lib/openapi3_parser/node_factories/request_body.rb +31 -0
- data/lib/openapi3_parser/node_factories/response.rb +45 -0
- data/lib/openapi3_parser/node_factories/responses.rb +32 -0
- data/lib/openapi3_parser/node_factories/schema.rb +106 -0
- data/lib/openapi3_parser/node_factories/security_requirement.rb +25 -0
- data/lib/openapi3_parser/node_factories/security_scheme.rb +35 -0
- data/lib/openapi3_parser/node_factories/server.rb +32 -0
- data/lib/openapi3_parser/node_factories/server_variable.rb +28 -0
- data/lib/openapi3_parser/node_factories/tag.rb +24 -0
- data/lib/openapi3_parser/node_factories/xml.rb +25 -0
- data/lib/openapi3_parser/node_factory.rb +126 -0
- data/lib/openapi3_parser/node_factory/field_config.rb +88 -0
- data/lib/openapi3_parser/node_factory/map.rb +39 -0
- data/lib/openapi3_parser/node_factory/object.rb +80 -0
- data/lib/openapi3_parser/node_factory/object/node_builder.rb +85 -0
- data/lib/openapi3_parser/node_factory/object/validator.rb +102 -0
- data/lib/openapi3_parser/node_factory/optional_reference.rb +23 -0
- data/lib/openapi3_parser/nodes/array.rb +26 -0
- data/lib/openapi3_parser/nodes/callback.rb +11 -0
- data/lib/openapi3_parser/nodes/components.rb +47 -0
- data/lib/openapi3_parser/nodes/contact.rb +23 -0
- data/lib/openapi3_parser/nodes/discriminator.rb +19 -0
- data/lib/openapi3_parser/nodes/encoding.rb +31 -0
- data/lib/openapi3_parser/nodes/example.rb +27 -0
- data/lib/openapi3_parser/nodes/external_documentation.rb +19 -0
- data/lib/openapi3_parser/nodes/header.rb +13 -0
- data/lib/openapi3_parser/nodes/info.rb +35 -0
- data/lib/openapi3_parser/nodes/license.rb +19 -0
- data/lib/openapi3_parser/nodes/link.rb +35 -0
- data/lib/openapi3_parser/nodes/map.rb +11 -0
- data/lib/openapi3_parser/nodes/media_type.rb +27 -0
- data/lib/openapi3_parser/nodes/oauth_flow.rb +27 -0
- data/lib/openapi3_parser/nodes/oauth_flows.rb +27 -0
- data/lib/openapi3_parser/nodes/openapi.rb +44 -0
- data/lib/openapi3_parser/nodes/operation.rb +59 -0
- data/lib/openapi3_parser/nodes/parameter.rb +21 -0
- data/lib/openapi3_parser/nodes/parameter/parameter_like.rb +53 -0
- data/lib/openapi3_parser/nodes/path_item.rb +59 -0
- data/lib/openapi3_parser/nodes/paths.rb +11 -0
- data/lib/openapi3_parser/nodes/request_body.rb +23 -0
- data/lib/openapi3_parser/nodes/response.rb +27 -0
- data/lib/openapi3_parser/nodes/responses.rb +15 -0
- data/lib/openapi3_parser/nodes/schema.rb +159 -0
- data/lib/openapi3_parser/nodes/security_requirement.rb +11 -0
- data/lib/openapi3_parser/nodes/security_scheme.rb +44 -0
- data/lib/openapi3_parser/nodes/server.rb +25 -0
- data/lib/openapi3_parser/nodes/server_variable.rb +23 -0
- data/lib/openapi3_parser/nodes/tag.rb +23 -0
- data/lib/openapi3_parser/nodes/xml.rb +31 -0
- data/lib/openapi3_parser/validation/error.rb +14 -0
- data/lib/openapi3_parser/validation/error_collection.rb +36 -0
- data/lib/openapi3_parser/version.rb +5 -0
- data/openapi3_parser.gemspec +28 -0
- metadata +208 -0
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "openapi3_parser/node/object"
|
4
|
+
|
5
|
+
module Openapi3Parser
|
6
|
+
module Nodes
|
7
|
+
class License
|
8
|
+
include Node::Object
|
9
|
+
|
10
|
+
def name
|
11
|
+
node_data["name"]
|
12
|
+
end
|
13
|
+
|
14
|
+
def url
|
15
|
+
node_data["url"]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "openapi3_parser/node/object"
|
4
|
+
|
5
|
+
module Openapi3Parser
|
6
|
+
module Nodes
|
7
|
+
class Link
|
8
|
+
include Node::Object
|
9
|
+
|
10
|
+
def operation_ref
|
11
|
+
node_data["operationRef"]
|
12
|
+
end
|
13
|
+
|
14
|
+
def operation_id
|
15
|
+
node_data["operationId"]
|
16
|
+
end
|
17
|
+
|
18
|
+
def parameters
|
19
|
+
node_data["parameters"]
|
20
|
+
end
|
21
|
+
|
22
|
+
def request_body
|
23
|
+
node_data["requestBody"]
|
24
|
+
end
|
25
|
+
|
26
|
+
def description
|
27
|
+
node_data["description"]
|
28
|
+
end
|
29
|
+
|
30
|
+
def server
|
31
|
+
node_data["server"]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "openapi3_parser/node/object"
|
4
|
+
|
5
|
+
module Openapi3Parser
|
6
|
+
module Nodes
|
7
|
+
class MediaType
|
8
|
+
include Node::Object
|
9
|
+
|
10
|
+
def schema
|
11
|
+
node_data["schema"]
|
12
|
+
end
|
13
|
+
|
14
|
+
def example
|
15
|
+
node_data["example"]
|
16
|
+
end
|
17
|
+
|
18
|
+
def examples
|
19
|
+
node_data["examples"]
|
20
|
+
end
|
21
|
+
|
22
|
+
def encoding
|
23
|
+
node_data["encoding"]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "openapi3_parser/node/object"
|
4
|
+
|
5
|
+
module Openapi3Parser
|
6
|
+
module Nodes
|
7
|
+
class OauthFlow
|
8
|
+
include Node::Object
|
9
|
+
|
10
|
+
def authorization_url
|
11
|
+
node_data["authorizationUrl"]
|
12
|
+
end
|
13
|
+
|
14
|
+
def token_url
|
15
|
+
node_data["tokenUrl"]
|
16
|
+
end
|
17
|
+
|
18
|
+
def refresh_url
|
19
|
+
node_data["refreshUrl"]
|
20
|
+
end
|
21
|
+
|
22
|
+
def scopes
|
23
|
+
node_data["scopes"]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "openapi3_parser/node/object"
|
4
|
+
|
5
|
+
module Openapi3Parser
|
6
|
+
module Nodes
|
7
|
+
class OauthFlows
|
8
|
+
include Node::Object
|
9
|
+
|
10
|
+
def implicit
|
11
|
+
node_data["implicit"]
|
12
|
+
end
|
13
|
+
|
14
|
+
def password
|
15
|
+
node_data["password"]
|
16
|
+
end
|
17
|
+
|
18
|
+
def client_credentials
|
19
|
+
node_data["clientCredentials"]
|
20
|
+
end
|
21
|
+
|
22
|
+
def authorization_code
|
23
|
+
node_data["authorizationCode"]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "openapi3_parser/node/object"
|
4
|
+
require "openapi3_parser/nodes/components"
|
5
|
+
|
6
|
+
module Openapi3Parser
|
7
|
+
module Nodes
|
8
|
+
class Openapi
|
9
|
+
include Node::Object
|
10
|
+
|
11
|
+
def openapi
|
12
|
+
node_data["openapi"]
|
13
|
+
end
|
14
|
+
|
15
|
+
def info
|
16
|
+
node_data["info"]
|
17
|
+
end
|
18
|
+
|
19
|
+
def servers
|
20
|
+
node_data["servers"]
|
21
|
+
end
|
22
|
+
|
23
|
+
def paths
|
24
|
+
node_data["paths"]
|
25
|
+
end
|
26
|
+
|
27
|
+
def components
|
28
|
+
node_data["components"]
|
29
|
+
end
|
30
|
+
|
31
|
+
def security
|
32
|
+
node_data["security"]
|
33
|
+
end
|
34
|
+
|
35
|
+
def tags
|
36
|
+
node_data["tags"]
|
37
|
+
end
|
38
|
+
|
39
|
+
def external_docs
|
40
|
+
node_data["externalDocs"]
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "openapi3_parser/node/object"
|
4
|
+
|
5
|
+
module Openapi3Parser
|
6
|
+
module Nodes
|
7
|
+
class Operation
|
8
|
+
include Node::Object
|
9
|
+
|
10
|
+
def tags
|
11
|
+
node_data["tags"]
|
12
|
+
end
|
13
|
+
|
14
|
+
def summary
|
15
|
+
node_data["summary"]
|
16
|
+
end
|
17
|
+
|
18
|
+
def description
|
19
|
+
node_data["description"]
|
20
|
+
end
|
21
|
+
|
22
|
+
def external_docs
|
23
|
+
node_data["externalDocs"]
|
24
|
+
end
|
25
|
+
|
26
|
+
def operation_id
|
27
|
+
node_data["operationId"]
|
28
|
+
end
|
29
|
+
|
30
|
+
def parameters
|
31
|
+
node_data["parameters"]
|
32
|
+
end
|
33
|
+
|
34
|
+
def request_body
|
35
|
+
node_data["requestBody"]
|
36
|
+
end
|
37
|
+
|
38
|
+
def responses
|
39
|
+
node_data["responses"]
|
40
|
+
end
|
41
|
+
|
42
|
+
def callbacks
|
43
|
+
node_data["callbacks"]
|
44
|
+
end
|
45
|
+
|
46
|
+
def deprecated?
|
47
|
+
node_data["deprecated"]
|
48
|
+
end
|
49
|
+
|
50
|
+
def security
|
51
|
+
node_data["security"]
|
52
|
+
end
|
53
|
+
|
54
|
+
def servers
|
55
|
+
node_data["servers"]
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "openapi3_parser/node/object"
|
4
|
+
require "openapi3_parser/nodes/parameter/parameter_like"
|
5
|
+
|
6
|
+
module Openapi3Parser
|
7
|
+
module Nodes
|
8
|
+
class Parameter
|
9
|
+
include Node::Object
|
10
|
+
include ParameterLike
|
11
|
+
|
12
|
+
def name
|
13
|
+
node_data["name"]
|
14
|
+
end
|
15
|
+
|
16
|
+
def in
|
17
|
+
node_data["in"]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Openapi3Parser
|
4
|
+
module Nodes
|
5
|
+
class Parameter
|
6
|
+
module ParameterLike
|
7
|
+
def description
|
8
|
+
node_data["description"]
|
9
|
+
end
|
10
|
+
|
11
|
+
def required?
|
12
|
+
node_data["required"]
|
13
|
+
end
|
14
|
+
|
15
|
+
def deprecated?
|
16
|
+
node_data["deprecated"]
|
17
|
+
end
|
18
|
+
|
19
|
+
def allow_empty_value?
|
20
|
+
node_data["allowEmptyValue"]
|
21
|
+
end
|
22
|
+
|
23
|
+
def style
|
24
|
+
node_data["style"]
|
25
|
+
end
|
26
|
+
|
27
|
+
def explode?
|
28
|
+
node_data["explode"]
|
29
|
+
end
|
30
|
+
|
31
|
+
def allow_reserved?
|
32
|
+
node_data["allowReserved"]
|
33
|
+
end
|
34
|
+
|
35
|
+
def schema
|
36
|
+
node_data["schema"]
|
37
|
+
end
|
38
|
+
|
39
|
+
def example
|
40
|
+
node_data["example"]
|
41
|
+
end
|
42
|
+
|
43
|
+
def examples
|
44
|
+
node_data["examples"]
|
45
|
+
end
|
46
|
+
|
47
|
+
def content
|
48
|
+
node_data["content"]
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "openapi3_parser/node/object"
|
4
|
+
|
5
|
+
module Openapi3Parser
|
6
|
+
module Nodes
|
7
|
+
class PathItem
|
8
|
+
include Node::Object
|
9
|
+
|
10
|
+
def summary
|
11
|
+
node_data["summary"]
|
12
|
+
end
|
13
|
+
|
14
|
+
def description
|
15
|
+
node_data["description"]
|
16
|
+
end
|
17
|
+
|
18
|
+
def get
|
19
|
+
node_data["get"]
|
20
|
+
end
|
21
|
+
|
22
|
+
def put
|
23
|
+
node_data["put"]
|
24
|
+
end
|
25
|
+
|
26
|
+
def post
|
27
|
+
node_data["post"]
|
28
|
+
end
|
29
|
+
|
30
|
+
def delete
|
31
|
+
node_data["delete"]
|
32
|
+
end
|
33
|
+
|
34
|
+
def options
|
35
|
+
node_data["options"]
|
36
|
+
end
|
37
|
+
|
38
|
+
def head
|
39
|
+
node_data["head"]
|
40
|
+
end
|
41
|
+
|
42
|
+
def patch
|
43
|
+
node_data["patch"]
|
44
|
+
end
|
45
|
+
|
46
|
+
def trace
|
47
|
+
node_data["trace"]
|
48
|
+
end
|
49
|
+
|
50
|
+
def servers
|
51
|
+
node_data["servers"]
|
52
|
+
end
|
53
|
+
|
54
|
+
def parameters
|
55
|
+
node_data["parameters"]
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "openapi3_parser/node/object"
|
4
|
+
|
5
|
+
module Openapi3Parser
|
6
|
+
module Nodes
|
7
|
+
class RequestBody
|
8
|
+
include Node::Object
|
9
|
+
|
10
|
+
def description
|
11
|
+
node_data["description"]
|
12
|
+
end
|
13
|
+
|
14
|
+
def content
|
15
|
+
node_data["content"]
|
16
|
+
end
|
17
|
+
|
18
|
+
def required?
|
19
|
+
node_data["required"]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "openapi3_parser/node/object"
|
4
|
+
|
5
|
+
module Openapi3Parser
|
6
|
+
module Nodes
|
7
|
+
class Response
|
8
|
+
include Node::Object
|
9
|
+
|
10
|
+
def description
|
11
|
+
node_data["description"]
|
12
|
+
end
|
13
|
+
|
14
|
+
def headers
|
15
|
+
node_data["headers"]
|
16
|
+
end
|
17
|
+
|
18
|
+
def content
|
19
|
+
node_data["content"]
|
20
|
+
end
|
21
|
+
|
22
|
+
def links
|
23
|
+
node_data["links"]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|