openapi3_parser 0.3.0 → 0.4.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 +4 -4
- data/.rubocop.yml +4 -0
- data/.travis.yml +3 -5
- data/CHANGELOG.md +7 -0
- data/README.md +2 -2
- data/TODO.md +9 -2
- data/lib/openapi3_parser/context/pointer.rb +2 -0
- data/lib/openapi3_parser/document.rb +54 -18
- data/lib/openapi3_parser/markdown.rb +15 -0
- data/lib/openapi3_parser/{nodes → node}/array.rb +1 -1
- data/lib/openapi3_parser/{nodes → node}/callback.rb +2 -4
- data/lib/openapi3_parser/{nodes → node}/components.rb +2 -4
- data/lib/openapi3_parser/{nodes → node}/contact.rb +2 -4
- data/lib/openapi3_parser/{nodes → node}/discriminator.rb +2 -4
- data/lib/openapi3_parser/{nodes → node}/encoding.rb +2 -4
- data/lib/openapi3_parser/{nodes → node}/example.rb +7 -4
- data/lib/openapi3_parser/{nodes → node}/external_documentation.rb +7 -4
- data/lib/openapi3_parser/{nodes → node}/header.rb +4 -5
- data/lib/openapi3_parser/{nodes → node}/info.rb +9 -6
- data/lib/openapi3_parser/{nodes → node}/license.rb +2 -4
- data/lib/openapi3_parser/{nodes → node}/link.rb +7 -4
- data/lib/openapi3_parser/node/map.rb +1 -1
- data/lib/openapi3_parser/{nodes → node}/media_type.rb +2 -4
- data/lib/openapi3_parser/{nodes → node}/oauth_flow.rb +2 -4
- data/lib/openapi3_parser/{nodes → node}/oauth_flows.rb +2 -4
- data/lib/openapi3_parser/node/object.rb +11 -1
- data/lib/openapi3_parser/{nodes → node}/openapi.rb +6 -8
- data/lib/openapi3_parser/{nodes → node}/operation.rb +11 -8
- data/lib/openapi3_parser/{nodes → node}/parameter.rb +3 -4
- data/lib/openapi3_parser/node/parameter_like.rb +70 -0
- data/lib/openapi3_parser/{nodes → node}/path_item.rb +9 -6
- data/lib/openapi3_parser/{nodes → node}/paths.rb +2 -4
- data/lib/openapi3_parser/{nodes → node}/request_body.rb +7 -4
- data/lib/openapi3_parser/{nodes → node}/response.rb +7 -4
- data/lib/openapi3_parser/{nodes → node}/responses.rb +2 -4
- data/lib/openapi3_parser/{nodes → node}/schema.rb +12 -9
- data/lib/openapi3_parser/{nodes → node}/security_requirement.rb +2 -4
- data/lib/openapi3_parser/{nodes → node}/security_scheme.rb +7 -5
- data/lib/openapi3_parser/{nodes → node}/server.rb +7 -4
- data/lib/openapi3_parser/{nodes → node}/server_variable.rb +8 -5
- data/lib/openapi3_parser/{nodes → node}/tag.rb +7 -4
- data/lib/openapi3_parser/{nodes → node}/xml.rb +2 -4
- data/lib/openapi3_parser/node_factories/array.rb +10 -4
- data/lib/openapi3_parser/node_factories/callback.rb +2 -2
- data/lib/openapi3_parser/node_factories/components.rb +5 -3
- data/lib/openapi3_parser/node_factories/contact.rb +10 -4
- data/lib/openapi3_parser/node_factories/discriminator.rb +2 -2
- data/lib/openapi3_parser/node_factories/encoding.rb +7 -3
- data/lib/openapi3_parser/node_factories/example.rb +8 -3
- data/lib/openapi3_parser/node_factories/external_documentation.rb +7 -3
- data/lib/openapi3_parser/node_factories/header.rb +2 -2
- data/lib/openapi3_parser/node_factories/info.rb +6 -3
- data/lib/openapi3_parser/node_factories/license.rb +6 -3
- data/lib/openapi3_parser/node_factories/link.rb +4 -2
- data/lib/openapi3_parser/node_factories/map.rb +12 -4
- data/lib/openapi3_parser/node_factories/media_type.rb +36 -5
- data/lib/openapi3_parser/node_factories/oauth_flow.rb +2 -2
- data/lib/openapi3_parser/node_factories/oauth_flows.rb +2 -2
- data/lib/openapi3_parser/node_factories/openapi.rb +13 -3
- data/lib/openapi3_parser/node_factories/operation.rb +11 -3
- data/lib/openapi3_parser/node_factories/parameter.rb +28 -3
- data/lib/openapi3_parser/node_factories/parameter/parameter_like.rb +9 -5
- data/lib/openapi3_parser/node_factories/path_item.rb +26 -7
- data/lib/openapi3_parser/node_factories/paths.rb +51 -2
- data/lib/openapi3_parser/node_factories/reference.rb +4 -0
- data/lib/openapi3_parser/node_factories/request_body.rb +32 -3
- data/lib/openapi3_parser/node_factories/response.rb +24 -4
- data/lib/openapi3_parser/node_factories/responses.rb +28 -2
- data/lib/openapi3_parser/node_factories/schema.rb +17 -3
- data/lib/openapi3_parser/node_factories/security_requirement.rb +2 -2
- data/lib/openapi3_parser/node_factories/security_scheme.rb +2 -2
- data/lib/openapi3_parser/node_factories/server.rb +2 -2
- data/lib/openapi3_parser/node_factories/server_variable.rb +2 -2
- data/lib/openapi3_parser/node_factories/tag.rb +2 -2
- data/lib/openapi3_parser/node_factories/xml.rb +6 -3
- data/lib/openapi3_parser/node_factory.rb +10 -4
- data/lib/openapi3_parser/node_factory/fields/reference.rb +4 -0
- data/lib/openapi3_parser/node_factory/map.rb +10 -0
- data/lib/openapi3_parser/node_factory/object.rb +29 -0
- data/lib/openapi3_parser/node_factory/object/validator.rb +69 -6
- data/lib/openapi3_parser/source/reference.rb +2 -0
- data/lib/openapi3_parser/source/reference_resolver.rb +5 -1
- data/lib/openapi3_parser/validators/absolute_uri.rb +14 -0
- data/lib/openapi3_parser/validators/component_keys.rb +17 -0
- data/lib/openapi3_parser/validators/duplicate_parameters.rb +30 -0
- data/lib/openapi3_parser/validators/email.rb +23 -0
- data/lib/openapi3_parser/validators/media_type.rb +20 -0
- data/lib/openapi3_parser/validators/url.rb +18 -0
- data/lib/openapi3_parser/version.rb +1 -1
- data/openapi3_parser.gemspec +5 -2
- metadata +70 -36
- data/lib/openapi3_parser/nodes/map.rb +0 -17
- data/lib/openapi3_parser/nodes/parameter/parameter_like.rb +0 -67
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 39b97559bdb240544c9f0f65b848c71edc28af1c
|
|
4
|
+
data.tar.gz: b8b1339e8d116a202a16ada58ffb75cf403f608f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5a9772d8bfd2c67b3736f32aa25d937c08c1fc76f8142bc92685f3cc2f0202a7c74f313d6e836d1ddcf92b15b99084b94e056d53ed299b437eefd15f56387eff
|
|
7
|
+
data.tar.gz: c47362a370307d40b1497e8b1c67e58ce267efaa611e0f0b49765ab3f2769635aba04f67f611250a1125116cadca09ac4d6d6372290253069192336c641169ba
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# 0.4.0
|
|
2
|
+
|
|
3
|
+
- Determine the OpenAPI specification version and store it in document.
|
|
4
|
+
- Support commonmark rendering, add description_html methods to nodes which
|
|
5
|
+
allow description to be rendered as HTML.
|
|
6
|
+
- Fix bug with CGI constant unresolved
|
|
7
|
+
|
|
1
8
|
# 0.3.0
|
|
2
9
|
|
|
3
10
|
- Allow opening files by URL
|
data/README.md
CHANGED
|
@@ -23,7 +23,7 @@ Documentation for the API to navigate the OpenAPI nodes is available on
|
|
|
23
23
|
[rubydoc.info][docs].
|
|
24
24
|
|
|
25
25
|
[openapi-3]: https://github.com/OAI/OpenAPI-Specification
|
|
26
|
-
[docs]: http://www.rubydoc.info/github/kevindew/openapi3_parser/Openapi3Parser/
|
|
26
|
+
[docs]: http://www.rubydoc.info/github/kevindew/openapi3_parser/Openapi3Parser/Node/Openapi
|
|
27
27
|
|
|
28
28
|
## Installation
|
|
29
29
|
|
|
@@ -31,7 +31,7 @@ You can install this gem into your bundler application by adding this line to
|
|
|
31
31
|
your Gemfile:
|
|
32
32
|
|
|
33
33
|
```
|
|
34
|
-
gem "openapi3_parser", "~> 0.
|
|
34
|
+
gem "openapi3_parser", "~> 0.3.0"
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
and then running `$ bundle install`
|
data/TODO.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
These are the steps defined to reach 1.0. Assistance is very welcome.
|
|
4
4
|
|
|
5
|
-
- [
|
|
5
|
+
- [x] Handle mutually exclusive fields
|
|
6
6
|
- [ ] Refactor the various NodeFactory modules to be a less confusing
|
|
7
7
|
hierachical structure. Consider having factories subclass instead of use
|
|
8
8
|
mixin
|
|
@@ -14,7 +14,7 @@ These are the steps defined to reach 1.0. Assistance is very welcome.
|
|
|
14
14
|
- [x] Allow opening of openapi documents by URL
|
|
15
15
|
- [x] Support references by URL
|
|
16
16
|
- [ ] Consider option to limit open by URL/path behaviour
|
|
17
|
-
- [
|
|
17
|
+
- [x] Support converting CommonMark to HTML
|
|
18
18
|
- [ ] Reach parity with OpenAPI specification for validation
|
|
19
19
|
- [ ] Consider a lenient mode for a document to only have to comply with type
|
|
20
20
|
based validation
|
|
@@ -32,3 +32,10 @@ These are the steps defined to reach 1.0. Assistance is very welcome.
|
|
|
32
32
|
- [x] Ensure Array and Map nodes return empty ones by default rather than nil
|
|
33
33
|
- [ ] Make JSON pointer public access to be consistent accepting string, array
|
|
34
34
|
or (potentially) a pointer class
|
|
35
|
+
- [ ] Support creating a default Server object on servers property of OpenAPI
|
|
36
|
+
Node
|
|
37
|
+
- [ ] Support relative URLs being able to be relative the first server object
|
|
38
|
+
see: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#relative-references-in-urls
|
|
39
|
+
- [ ] Support validating a Server URL based on default values
|
|
40
|
+
- [ ] Validate paths to check path parameters within them appear in paths
|
|
41
|
+
see: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#fixed-fields-10
|
|
@@ -13,12 +13,21 @@ module Openapi3Parser
|
|
|
13
13
|
# Document is the root construct of a created OpenAPI Document and can be
|
|
14
14
|
# used to navigate the contents of a document or to check it's validity.
|
|
15
15
|
#
|
|
16
|
-
# @attr_reader [
|
|
16
|
+
# @attr_reader [String] openapi_version
|
|
17
|
+
# @attr_reader [Source] root_source
|
|
18
|
+
# @attr_reader [Array<String>] warnings
|
|
17
19
|
class Document
|
|
18
20
|
extend Forwardable
|
|
19
21
|
include Enumerable
|
|
20
22
|
|
|
21
|
-
attr_reader :root_source
|
|
23
|
+
attr_reader :openapi_version, :root_source, :warnings
|
|
24
|
+
|
|
25
|
+
# A collection of the openapi versions that are supported
|
|
26
|
+
SUPPORTED_OPENAPI_VERSIONS = %w[3.0].freeze
|
|
27
|
+
|
|
28
|
+
# The version of OpenAPI that will be used by default for
|
|
29
|
+
# validation/construction
|
|
30
|
+
DEFAULT_OPENAPI_VERSION = "3.0"
|
|
22
31
|
|
|
23
32
|
# @!method valid?
|
|
24
33
|
# Whether this OpenAPI document has any validation issues or not. See
|
|
@@ -29,36 +38,36 @@ module Openapi3Parser
|
|
|
29
38
|
|
|
30
39
|
# @!method openapi
|
|
31
40
|
# The value of the openapi version field for this document
|
|
32
|
-
# @see
|
|
41
|
+
# @see Node::Openapi#openapi
|
|
33
42
|
# @return [String]
|
|
34
43
|
# @!method info
|
|
35
44
|
# The value of the info field on the OpenAPI document
|
|
36
|
-
# @see
|
|
37
|
-
# @return [
|
|
45
|
+
# @see Node::Openapi#info
|
|
46
|
+
# @return [Node::Info]
|
|
38
47
|
# @!method servers
|
|
39
48
|
# The value of the servers field on the OpenAPI document
|
|
40
|
-
# @see
|
|
41
|
-
# @return [
|
|
49
|
+
# @see Node::Openapi#servers
|
|
50
|
+
# @return [Node::Array<Node::Server>]
|
|
42
51
|
# @!method paths
|
|
43
52
|
# The value of the paths field on the OpenAPI document
|
|
44
|
-
# @see
|
|
45
|
-
# @return [
|
|
53
|
+
# @see Node::Openapi#paths
|
|
54
|
+
# @return [Node::Paths]
|
|
46
55
|
# @!method components
|
|
47
56
|
# The value of the components field on the OpenAPI document
|
|
48
|
-
# @see
|
|
49
|
-
# @return [
|
|
57
|
+
# @see Node::Openapi#components
|
|
58
|
+
# @return [Node::Components]
|
|
50
59
|
# @!method security
|
|
51
60
|
# The value of the security field on the OpenAPI document
|
|
52
|
-
# @see
|
|
53
|
-
# @return [
|
|
61
|
+
# @see Node::Openapi#security
|
|
62
|
+
# @return [Node::Array<Node::SecurityRequirement>]
|
|
54
63
|
# @!method tags
|
|
55
64
|
# The value of the tags field on the OpenAPI document
|
|
56
|
-
# @see
|
|
57
|
-
# @return [
|
|
65
|
+
# @see Node::Openapi#tags
|
|
66
|
+
# @return [Node::Array<Node::Tag>]
|
|
58
67
|
# @!method external_docs
|
|
59
68
|
# The value of the external_docs field on the OpenAPI document
|
|
60
|
-
# @see
|
|
61
|
-
# @return [
|
|
69
|
+
# @see Node::Openapi#external_docs
|
|
70
|
+
# @return [Node::ExternalDocumentation]
|
|
62
71
|
# @!method extension
|
|
63
72
|
# Look up an extension field provided for the root object of the document
|
|
64
73
|
# @see Node::Object#extension
|
|
@@ -78,11 +87,13 @@ module Openapi3Parser
|
|
|
78
87
|
def initialize(source_input)
|
|
79
88
|
@reference_register = ReferenceRegister.new
|
|
80
89
|
@root_source = Source.new(source_input, self, reference_register)
|
|
90
|
+
@warnings = []
|
|
91
|
+
@openapi_version = determine_openapi_version(root_source.data["openapi"])
|
|
81
92
|
@build_in_progress = false
|
|
82
93
|
@built = false
|
|
83
94
|
end
|
|
84
95
|
|
|
85
|
-
# @return [
|
|
96
|
+
# @return [Node::Openapi]
|
|
86
97
|
def root
|
|
87
98
|
factory.node
|
|
88
99
|
end
|
|
@@ -125,16 +136,41 @@ module Openapi3Parser
|
|
|
125
136
|
|
|
126
137
|
attr_reader :reference_register, :built, :build_in_progress
|
|
127
138
|
|
|
139
|
+
def add_warning(text)
|
|
140
|
+
@warnings << text
|
|
141
|
+
end
|
|
142
|
+
|
|
128
143
|
def build
|
|
129
144
|
return if build_in_progress || built
|
|
130
145
|
@build_in_progress = true
|
|
131
146
|
context = Context.root(root_source.data, root_source)
|
|
132
147
|
@factory = NodeFactories::Openapi.new(context)
|
|
133
148
|
reference_register.freeze
|
|
149
|
+
@warnings.freeze
|
|
134
150
|
@build_in_progress = false
|
|
135
151
|
@built = true
|
|
136
152
|
end
|
|
137
153
|
|
|
154
|
+
def determine_openapi_version(version)
|
|
155
|
+
minor_version = (version || "").split(".").first(2).join(".")
|
|
156
|
+
|
|
157
|
+
if SUPPORTED_OPENAPI_VERSIONS.include?(minor_version)
|
|
158
|
+
minor_version
|
|
159
|
+
elsif version
|
|
160
|
+
add_warning(
|
|
161
|
+
"Unsupported OpenAPI version (#{version}), treating as a " \
|
|
162
|
+
"#{DEFAULT_OPENAPI_VERSION} document"
|
|
163
|
+
)
|
|
164
|
+
DEFAULT_OPENAPI_VERSION
|
|
165
|
+
else
|
|
166
|
+
add_warning(
|
|
167
|
+
"Unspecified OpenAPI version, treating as a " \
|
|
168
|
+
"#{DEFAULT_OPENAPI_VERSION} document"
|
|
169
|
+
)
|
|
170
|
+
DEFAULT_OPENAPI_VERSION
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
|
|
138
174
|
def factory
|
|
139
175
|
build unless built
|
|
140
176
|
@factory
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "commonmarker"
|
|
4
|
+
|
|
5
|
+
module Openapi3Parser
|
|
6
|
+
# Wrapper around a gem to render markdown, used a single place for options
|
|
7
|
+
# and handling the gem
|
|
8
|
+
module Markdown
|
|
9
|
+
# @param [String] text
|
|
10
|
+
# @return [String]
|
|
11
|
+
def self.to_html(text)
|
|
12
|
+
CommonMarker.render_doc(text).to_html
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
require "openapi3_parser/node/map"
|
|
4
4
|
|
|
5
5
|
module Openapi3Parser
|
|
6
|
-
module
|
|
6
|
+
module Node
|
|
7
7
|
# @see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#callbackObject
|
|
8
|
-
class Callback
|
|
9
|
-
include Node::Map
|
|
10
|
-
end
|
|
8
|
+
class Callback < Node::Map; end
|
|
11
9
|
end
|
|
12
10
|
end
|
|
@@ -3,11 +3,9 @@
|
|
|
3
3
|
require "openapi3_parser/node/object"
|
|
4
4
|
|
|
5
5
|
module Openapi3Parser
|
|
6
|
-
module
|
|
6
|
+
module Node
|
|
7
7
|
# @see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#componentsObject
|
|
8
|
-
class Components
|
|
9
|
-
include Node::Object
|
|
10
|
-
|
|
8
|
+
class Components < Node::Object
|
|
11
9
|
# @return [Map<String, Schema>]
|
|
12
10
|
def schemas
|
|
13
11
|
node_data["schemas"]
|
|
@@ -3,11 +3,9 @@
|
|
|
3
3
|
require "openapi3_parser/node/object"
|
|
4
4
|
|
|
5
5
|
module Openapi3Parser
|
|
6
|
-
module
|
|
6
|
+
module Node
|
|
7
7
|
# @see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#contactObject
|
|
8
|
-
class Contact
|
|
9
|
-
include Node::Object
|
|
10
|
-
|
|
8
|
+
class Contact < Node::Object
|
|
11
9
|
# @return [String, nil]
|
|
12
10
|
def name
|
|
13
11
|
data["name"]
|
|
@@ -3,11 +3,9 @@
|
|
|
3
3
|
require "openapi3_parser/node/object"
|
|
4
4
|
|
|
5
5
|
module Openapi3Parser
|
|
6
|
-
module
|
|
6
|
+
module Node
|
|
7
7
|
# @see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#discriminatorObject
|
|
8
|
-
class Discriminator
|
|
9
|
-
include Node::Object
|
|
10
|
-
|
|
8
|
+
class Discriminator < Node::Object
|
|
11
9
|
# @return [String]
|
|
12
10
|
def property_name
|
|
13
11
|
node_data["propertyName"]
|
|
@@ -3,11 +3,9 @@
|
|
|
3
3
|
require "openapi3_parser/node/object"
|
|
4
4
|
|
|
5
5
|
module Openapi3Parser
|
|
6
|
-
module
|
|
6
|
+
module Node
|
|
7
7
|
# @see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#encodingObject
|
|
8
|
-
class Encoding
|
|
9
|
-
include Node::Object
|
|
10
|
-
|
|
8
|
+
class Encoding < Node::Object
|
|
11
9
|
# @return [String, nil]
|
|
12
10
|
def content_type
|
|
13
11
|
node_data["contentType"]
|
|
@@ -3,11 +3,9 @@
|
|
|
3
3
|
require "openapi3_parser/node/object"
|
|
4
4
|
|
|
5
5
|
module Openapi3Parser
|
|
6
|
-
module
|
|
6
|
+
module Node
|
|
7
7
|
# @see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#exampleObject
|
|
8
|
-
class Example
|
|
9
|
-
include Node::Object
|
|
10
|
-
|
|
8
|
+
class Example < Node::Object
|
|
11
9
|
# @return [String, nil]
|
|
12
10
|
def summary
|
|
13
11
|
node_data["summary"]
|
|
@@ -18,6 +16,11 @@ module Openapi3Parser
|
|
|
18
16
|
node_data["description"]
|
|
19
17
|
end
|
|
20
18
|
|
|
19
|
+
# @return [String, nil]
|
|
20
|
+
def description_html
|
|
21
|
+
render_markdown(description)
|
|
22
|
+
end
|
|
23
|
+
|
|
21
24
|
# @return [Object]
|
|
22
25
|
def value
|
|
23
26
|
node_data["value"]
|
|
@@ -3,16 +3,19 @@
|
|
|
3
3
|
require "openapi3_parser/node/object"
|
|
4
4
|
|
|
5
5
|
module Openapi3Parser
|
|
6
|
-
module
|
|
6
|
+
module Node
|
|
7
7
|
# @see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#externalDocumentationObject
|
|
8
|
-
class ExternalDocumentation
|
|
9
|
-
include Node::Object
|
|
10
|
-
|
|
8
|
+
class ExternalDocumentation < Node::Object
|
|
11
9
|
# @return [String, nil]
|
|
12
10
|
def description
|
|
13
11
|
node_data["description"]
|
|
14
12
|
end
|
|
15
13
|
|
|
14
|
+
# @return [String, nil]
|
|
15
|
+
def description_html
|
|
16
|
+
render_markdown(description)
|
|
17
|
+
end
|
|
18
|
+
|
|
16
19
|
# @return [String]
|
|
17
20
|
def url
|
|
18
21
|
node_data["url"]
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "openapi3_parser/node/object"
|
|
4
|
-
require "openapi3_parser/
|
|
4
|
+
require "openapi3_parser/node/parameter_like"
|
|
5
5
|
|
|
6
6
|
module Openapi3Parser
|
|
7
|
-
module
|
|
7
|
+
module Node
|
|
8
8
|
# @see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#headerObject
|
|
9
|
-
class Header
|
|
10
|
-
include
|
|
11
|
-
include Parameter::ParameterLike
|
|
9
|
+
class Header < Node::Object
|
|
10
|
+
include ParameterLike
|
|
12
11
|
end
|
|
13
12
|
end
|
|
14
13
|
end
|
|
@@ -3,22 +3,25 @@
|
|
|
3
3
|
require "openapi3_parser/node/object"
|
|
4
4
|
|
|
5
5
|
module Openapi3Parser
|
|
6
|
-
module
|
|
6
|
+
module Node
|
|
7
7
|
# @see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#infoObject
|
|
8
|
-
class Info
|
|
9
|
-
include Node::Object
|
|
10
|
-
|
|
8
|
+
class Info < Node::Object
|
|
11
9
|
# @return [String]
|
|
12
10
|
def title
|
|
13
11
|
node_data["title"]
|
|
14
12
|
end
|
|
15
13
|
|
|
16
|
-
# @return [String,
|
|
14
|
+
# @return [String, nil]
|
|
17
15
|
def description
|
|
18
16
|
node_data["description"]
|
|
19
17
|
end
|
|
20
18
|
|
|
21
|
-
# @return [String,
|
|
19
|
+
# @return [String, nil]
|
|
20
|
+
def description_html
|
|
21
|
+
render_markdown(description)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# @return [String, nil]
|
|
22
25
|
def terms_of_service
|
|
23
26
|
node_data["termsOfService"]
|
|
24
27
|
end
|
|
@@ -3,11 +3,9 @@
|
|
|
3
3
|
require "openapi3_parser/node/object"
|
|
4
4
|
|
|
5
5
|
module Openapi3Parser
|
|
6
|
-
module
|
|
6
|
+
module Node
|
|
7
7
|
# @see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#licenseObject
|
|
8
|
-
class License
|
|
9
|
-
include Node::Object
|
|
10
|
-
|
|
8
|
+
class License < Node::Object
|
|
11
9
|
# @return [String]
|
|
12
10
|
def name
|
|
13
11
|
node_data["name"]
|